Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve haxmap performance #48

Open
someview opened this issue Jun 11, 2024 · 1 comment
Open

improve haxmap performance #48

someview opened this issue Jun 11, 2024 · 1 comment

Comments

@someview
Copy link

I test some different map use cases. in every case(read 100%、99%、90%、75%、 50%) test code
xsync.mapof > concurrent-map(shard rwlock) > haxmap
the ConcurrentMap shard map with rwlock:

//goos: windows
//goarch: amd64
//pkg: benchmap
//cpu: 12th Gen Intel(R) Core(TM) i9-12900K
//BenchmarkConcurrentMap_WarmUp
//BenchmarkConcurrentMap_WarmUp/reads=100%
//BenchmarkConcurrentMap_WarmUp/reads=100%-24         	19311262	        59.97 ns/op	  16674108 ops/s
//BenchmarkConcurrentMap_WarmUp/reads=99%
//BenchmarkConcurrentMap_WarmUp/reads=99%-24          	19390272	        57.46 ns/op	  17403041 ops/s
//BenchmarkConcurrentMap_WarmUp/reads=90%
//BenchmarkConcurrentMap_WarmUp/reads=90%-24          	20722754	        58.18 ns/op	  17188562 ops/s
//BenchmarkConcurrentMap_WarmUp/reads=75%
//BenchmarkConcurrentMap_WarmUp/reads=75%-24          	19096568	        61.73 ns/op	  16198394 ops/s
//BenchmarkConcurrentMap_WarmUp/reads=50%
//BenchmarkConcurrentMap_WarmUp/reads=50%-24          	15739459	        69.01 ns/op	  14491307 ops/s

the xsync map result:

// goos: windows
// goarch: amd64
// pkg: benchmap
// cpu: 12th Gen Intel(R) Core(TM) i9-12900K
// BenchmarkXSyncMap_WarmUp
// BenchmarkXSyncMap_WarmUp/reads=100%
// BenchmarkXSyncMap_WarmUp/reads=100%-24         	24926673	        47.70 ns/op	  20964357 ops/s
// BenchmarkXSyncMap_WarmUp/reads=99%
// BenchmarkXSyncMap_WarmUp/reads=99%-24          	24938018	        47.36 ns/op	  21114211 ops/s
// BenchmarkXSyncMap_WarmUp/reads=90%
// BenchmarkXSyncMap_WarmUp/reads=90%-24          	24128313	        46.64 ns/op	  21440622 ops/s
// BenchmarkXSyncMap_WarmUp/reads=75%
// BenchmarkXSyncMap_WarmUp/reads=75%-24          	23475463	        54.89 ns/op	  18219448 ops/s
// BenchmarkXSyncMap_WarmUp/reads=50%
// BenchmarkXSyncMap_WarmUp/reads=50%-24          	20382096	        58.53 ns/op	  17084646 ops/s
// PASS

the haxmap result:

//goos: windows
//goarch: amd64
//pkg: benchmap
//cpu: 12th Gen Intel(R) Core(TM) i9-12900K
//BenchmarkHaxLockFreeMap_WarmUp
//BenchmarkHaxLockFreeMap_WarmUp/reads=100%
//BenchmarkHaxLockFreeMap_WarmUp/reads=100%-24         	17538038	        63.97 ns/op	  15631949 ops/s
//BenchmarkHaxLockFreeMap_WarmUp/reads=99%
//BenchmarkHaxLockFreeMap_WarmUp/reads=99%-24          	17473504	        63.95 ns/op	  15638035 ops/s
//BenchmarkHaxLockFreeMap_WarmUp/reads=90%
//BenchmarkHaxLockFreeMap_WarmUp/reads=90%-24          	16729821	        66.61 ns/op	  15012730 ops/s
//BenchmarkHaxLockFreeMap_WarmUp/reads=75%
//BenchmarkHaxLockFreeMap_WarmUp/reads=75%-24          	17592495	        69.28 ns/op	  14433428 ops/s
//BenchmarkHaxLockFreeMap_WarmUp/reads=50%
//BenchmarkHaxLockFreeMap_WarmUp/reads=50%-24          	15320367	        78.30 ns/op	  12770672 ops/s
//PASS

It's amazing. Maybe there cound be more performance for the lockfree map.

@alphadose
Copy link
Owner

It's amazing. Maybe there cound be more performance for the lockfree map.

there is an open issue to use xxh3 hashing instead of xxhash which might improve performance #41

I will look into it and publish the benchmarks for xxh3 vs xxhash for HaxMap sometime next week probably

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

No branches or pull requests

2 participants