Performance++
- Huge performance gain obtained by switching bucket implementation to Harris lock-free list followed by additional optimizations from this paper
- Fixed issue #54 from cornelk-hashmap which caused data loss on concurrent writes during map resize operations
- Added support for 32-bit systems and more map key types
Benchmarks
Benchmarks were performed against golang sync.Map and the latest generics-enabled cornelk-hashmap
All results were computed from benchstat of 20 runs (code available here)
- Concurrent Reads Only
name time/op
HaxMapReadsOnly-8 10.9µs ±11%
GoSyncMapReadsOnly-8 23.0µs ± 7%
CornelkMapReadsOnly-8 12.3µs ±11%
name alloc/op
HaxMapReadsOnly-8 0.00B
GoSyncMapReadsOnly-8 0.00B
CornelkMapReadsOnly-8 0.00B
name allocs/op
HaxMapReadsOnly-8 0.00
GoSyncMapReadsOnly-8 0.00
CornelkMapReadsOnly-8 0.00
- Concurrent Reads with Writes
name time/op
HaxMapReadsWithWrites-8 12.6µs ±11%
GoSyncMapReadsWithWrites-8 25.6µs ±10%
CornelkMapReadsWithWrites-8 14.3µs ±13%
name alloc/op
HaxMapReadsWithWrites-8 1.46kB ± 3%
GoSyncMapReadsWithWrites-8 6.19kB ± 6%
CornelkMapReadsWithWrites-8 6.70kB ± 9%
name allocs/op
HaxMapReadsOnly-8 0.00
HaxMapReadsWithWrites-8 183 ± 3%
GoSyncMapReadsOnly-8 0.00
GoSyncMapReadsWithWrites-8 573 ± 7%
CornelkMapReadsOnly-8 0.00
CornelkMapReadsWithWrites-8 239 ± 9%
From the above results it is evident that haxmap
takes the least time, memory and allocations in all cases