This package collects several hashmap implementations:
Unorderedhashmap is a classic hashmap with separate chaining in a single linked list per bucket to handle collisions.Robin Hoodhashmap is an open addressing hashmap with robin hood hashing and back shifting.Hopscotchhashmap is an open addressing hashmap with worst case constant runtime for lookup and delete operations.Flathashmap is an open addressing hashmap with linear probing.
go get -u github.com/EinfachAndy/hashmapspackage main
import (
"fmt"
"github.com/EinfachAndy/hashmaps/hopscotch"
)
func main() {
m := hopscotch.New[int, int]()
m.Reserve(100)
m.Put(1, 1)
fmt.Println(m.Get(1))
m.Remove(1)
fmt.Println(m.Get(1))
// Output:
// 1 true
// 0 false
}The benchmarks are implemented and maintained here.
If you would like to contribute a new feature or hashmap. please let me know first what you would like to add (via email or issue tracker).