Hashmap Versions Save

A Golang lock-free thread-safe HashMap optimized for fastest read access.

v1.0.8

1 year ago
  • improved hashing and avoid dedicated MapString type

v1.0.7

1 year ago
  • optimized hashing by separating string support into separate type
  • removed all external dependencies

v1.0.6

1 year ago
  • optimize hashing by Inlining hashing as anonymous functions
  • reduce allocations for write operations

v1.0.5

1 year ago
  • fix hashing on ARM CPUs
  • optimize hashing by using specialized xxhash implementations
  • reduce variable allocations in get functions
  • removed obsolete 0 length checks

It is noticeable faster than the current version of HaxMap is able to handle collisions of valid 0 hash values:

BenchmarkReadHashMapUint-8                	 1314156	       955.6 ns/op
BenchmarkReadHaxMapUint-8                 	  872134	      1316 ns/op (can not handle hash 0 collisions)
// works for this library, fails for HaxMap
func TestHash0Collision(t *testing.T) {
	m := New[string, int]()
	staticHasher := func(key string) uintptr {
		return 0
	}
	m.SetHasher(staticHasher)
	m.Set("1", 1)
	m.Set("2", 2)
	_, ok := m.Get("1")
	if !ok {
		t.Error("1 not found")
	}
	_, ok = m.Get("2")
	if !ok {
		t.Error("2 not found")
	}
}

v1.0.4

1 year ago
  • fixed insert during map grow
  • fixed add not working properly during concurrent delete
  • add SetHasher function to allow setting of a custom hasher
  • benchmarks have been moved to a subdirectory to remove imports for external libraries from main module

v1.0.3

1 year ago
  • CAS has been removed as it is not working
  • Iter function signature has been changed to Range
  • all comparable key types are supported now

v1.0.2

1 year ago
  • fix hash collision handling
  • switch library to use generics
  • minor API changes
  • CAS is currently not supported
  • removed []byte key support

v1.0.1

4 years ago
  • Fixed delete action when using hashed key
  • Fixed race condition in list