Closed joetifa2003 closed 2 months ago
Hi, really like your stuff!
Hi! Thanks!
I did a benchmark for you map implementation
Great job! I really liked that framework you established! I changed your implementation a bit, added couple more things to bench and my results are:
goos: linux
goarch: amd64
pkg: github.com/Snawoot/lfmap
cpu: Intel(R) N100
BenchmarkLFMapSet-4 199852 11756 ns/op
BenchmarkSyncMapSet-4 864440 2424 ns/op
BenchmarkLFMapGet-4 3098422 453.6 ns/op
BenchmarkSyncMapGet-4 5072394 216.5 ns/op
BenchmarkLFMapRange1000000-4 7 160304557 ns/op
BenchmarkSyncMapRange1000000-4 7 162762628 ns/op
PASS
ok github.com/Snawoot/lfmap 33.638s
And
sync.Map
becomes much faster when you increase the load, because of the memory being generated by immutable ds.So when is lfmap more useful than
sync.Map
?
So far lfmap is 2-6 times slower than sync.Map
, mostly because of underlying immutable ds performance.
But performance aside, LFMap provides:
sync.Map
doesn't guantee consistency of iteration, and may copy full map to new memory while LFMap is more like copy-on-write structure of specific affected parts.Also can you do an official benchmark and put it in the readme?
Your benchmark is now official one. The code with my changes is in master branch now.
Hi, really like your stuff!
I did a benchmark for you map implementation
And
sync.Map
becomes much faster when you increase the load, because of the memory being generated by immutable ds.So when is lfmap more useful than
sync.Map
?Also can you do an official benchmark and put it in the readme?