Skip to content

[Do Not Merge] Some benchmarks and insights#6

Open
ahsanbarkati wants to merge 2 commits into
shreybatra:mainfrom
ahsanbarkati:main
Open

[Do Not Merge] Some benchmarks and insights#6
ahsanbarkati wants to merge 2 commits into
shreybatra:mainfrom
ahsanbarkati:main

Conversation

@ahsanbarkati

@ahsanbarkati ahsanbarkati commented Jul 30, 2021

Copy link
Copy Markdown

Hey - It was fun playing around with this code. This PR is not meant to be merged, but only for the purpose of some demonstration. Sorry for a lot of refactoring, even changing the package name. But it was necessary to resolve some dependency chains. The problem is that gocrank and crank db have same packages in them (cql, server). So one can't be imported to other because of conflict. You should avoid code-duplication.

I have run a few benchmarks, which have the results as follows:

cpu: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
BenchmarkWriteWithClient
BenchmarkWriteWithClient-8   	   50504	     22872 ns/op
BenchmarkWriteNormal
BenchmarkWriteNormal-8       	10590692	       114.0 ns/op
BenchmarkWriteSM
BenchmarkWriteSM-8           	 4795395	       248.2 ns/op
BenchmarkRead
BenchmarkRead-8              	   51481	     23174 ns/op
BenchmarkReadNormal
BenchmarkReadNormal-8        	14897192	        80.30 ns/op
BenchmarkReadSM
BenchmarkReadSM-8            	170786281	         6.989 ns/op
BenchmarkParWriteRead
BenchmarkParWriteRead-8      	   49950	     23862 ns/op

If you observe, with sync maps, the read speed is super fast (almost 9 times faster). And if this is meant to be a read-heavy DB, then sync map is a better option (which has write speed x0.5 while read x9).

Second, I feel, rather than having an interface in the value, you should consider having just a byte slice. Interface conversion is heavy operation and mostly KVs are used for string, byte slices etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant