Haxmap Versions Save

Fastest and most memory efficient golang concurrent hashmap

v1.3.1

4 months ago

handle edge case to prevent panic during map initialization https://github.com/alphadose/haxmap/pull/44 @semihbkgr

v1.3.0

8 months ago

This release is all thanks to @semihbkgr 🙏

v1.2.0

1 year ago

v1.1.0

1 year ago

v1.0.2

1 year ago

Fix deadlock when multiple goroutines are trying to delete the same linked-list node https://github.com/alphadose/haxmap/commit/f4885e7522f138036dabe14c8eec0e5b7b66d0a6

v1.0.1

1 year ago

v1.0.0

1 year ago

v0.3.1

1 year ago

Notes

  • Improve hashing performance by switching to pure arithmetic and bitmasking for known key sizes

Benchmarks

Benchmarks were performed against golang sync.Map and the latest cornelk-hashmap

All results were computed from benchstat of 20 runs

  1. Concurrent Reads Only
name                         time/op
HaxMapReadsOnly-8            7.13µs ± 5%
GoSyncMapReadsOnly-8         22.4µs ± 2%
CornelkMapReadsOnly-8        8.28µs ± 1%
  1. Concurrent Reads with Writes
name                         time/op
HaxMapReadsWithWrites-8      8.44µs ± 5%
GoSyncMapReadsWithWrites-8   26.1µs ± 2%
CornelkMapReadsWithWrites-8  9.55µs ± 2%

name                         alloc/op
HaxMapReadsWithWrites-8      1.22kB ± 6%
GoSyncMapReadsWithWrites-8   6.06kB ± 6%
CornelkMapReadsWithWrites-8  1.56kB ± 5%

name                         allocs/op
HaxMapReadsWithWrites-8         152 ± 6%
GoSyncMapReadsWithWrites-8      562 ± 6%
CornelkMapReadsWithWrites-8     195 ± 5%

v0.3.0

1 year ago

Notes

Benchmarks

Benchmarks were performed against golang sync.Map and cornelk-hashmap-v1.0.6 for sample 20 cases

  1. Concurrent Reads Only
name                         time/op
HaxMapReadsOnly-8            8.75µs ± 9%
GoSyncMapReadsOnly-8         22.0µs ±11%
CornelkMapReadsOnly-8        9.20µs ±10%
  1. Concurrent Reads with Writes
name                         time/op
HaxMapReadsWithWrites-8      10.0µs ± 9%
GoSyncMapReadsWithWrites-8   24.8µs ±11%
CornelkMapReadsWithWrites-8  10.5µs ± 9%

name                         alloc/op
HaxMapReadsWithWrites-8      1.29kB ± 6%
GoSyncMapReadsWithWrites-8   6.20kB ± 5%
CornelkMapReadsWithWrites-8  1.59kB ±10%

name                         allocs/op
HaxMapReadsWithWrites-8         161 ± 4%
GoSyncMapReadsWithWrites-8      574 ± 5%
CornelkMapReadsWithWrites-8     198 ±10%

v0.2.2

1 year ago

Notes

Performance gain obtained by inlining hash function assignments

Benchmarks

Benchmarks were performed against golang sync.Map and the latest cornelk-hashmap

All results were computed from benchstat of 20 runs (code available here)

  1. Concurrent Reads Only
name                         time/op
HaxMapReadsOnly-8            9.18µs ±12%
GoSyncMapReadsOnly-8         22.5µs ± 5%
CornelkMapReadsOnly-8        10.4µs ± 4%

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
  1. Concurrent Reads with Writes
name                         time/op
HaxMapReadsWithWrites-8      10.5µs ± 7%
GoSyncMapReadsWithWrites-8   25.6µs ± 7%
CornelkMapReadsWithWrites-8  12.3µs ± 6%

name                         alloc/op
HaxMapReadsWithWrites-8      1.28kB ± 5%
GoSyncMapReadsWithWrites-8   6.23kB ± 6%
CornelkMapReadsWithWrites-8  5.89kB ± 7%

name                         allocs/op
HaxMapReadsWithWrites-8         159 ± 5%
GoSyncMapReadsWithWrites-8      577 ± 6%
CornelkMapReadsWithWrites-8     210 ± 8%

From the above results it is evident that haxmap takes the least time, memory and allocations in all cases