Skip to content

Releases: alphadose/haxmap

131

19 Dec 04:15
9300b14
Compare
Choose a tag to compare

handle edge case to prevent panic during map initialization #44 @semihbkgr

130

22 Aug 18:52
d41ce81
Compare
Choose a tag to compare
130

This release is all thanks to @semihbkgr 🙏

  • Added GetAndDel function similar to golang concurrent map's LoadAndDelete #31
  • JSON encoding support #29
  • Critical bug fixed with Set operation after Delete #34
  • No more unnecessary resizing #36
  • Fix logic of fillrate computation #38

120

14 Nov 13:15
Compare
Choose a tag to compare
120
  • Add atomic CompareAndSwap and Swap APIs #18
  • Improve deletion performance via lazily deleting nodes #17
  • Add GetOrCompute API which works similar to GetOrSet but the value is computed from a constructor which is called only once #16

110

21 Oct 12:00
Compare
Choose a tag to compare
110

Add GetOrSet() API same as golang's sync.Map.LoadOrStore #15

102

03 Oct 01:02
Compare
Choose a tag to compare
102

Fix deadlock when multiple goroutines are trying to delete the same linked-list node f4885e7

101

03 Oct 00:34
Compare
Choose a tag to compare
101
  • Support go 1.18 and above @StandoffVenus #13
  • Fix concurrent deletion issue #14
  • Add bulk deletion feature map.Del(keyA, keyB, keyC...)

Stable

21 Sep 15:01
Compare
Choose a tag to compare
  • Fix bug in delete operation #11
  • Fix deadlock bug during Set() #7 #8
  • Update ForEach() API to match golang's sync.Map.Range() #10

Performance improvement

31 Aug 21:48
Compare
Choose a tag to compare

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%

Performance improvement and fix 32-bit compatibility

31 Aug 03:48
Compare
Choose a tag to compare

Notes

  • Hashing performance improvement by type-casting keys to arrays instead of slices as seen in this commit eee8abe
  • Fixed tests for 32 bit platforms (tested on my raspberry pi running 32 bit raspian OS)
  • Make map growth policy synchronous

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%

Hashing performance improvement

29 Aug 07:16
Compare
Choose a tag to compare

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