This pull request adds a fast generic hash functions that can be used in MapOf.
This allowed to make two new constructors that do not require user to specify hash function manually
func NewUniversalMapOf[K comparable, V any]() *MapOf[K, V]
func NewUniversalMapOfPresized[K comparable, V any](sizeHint int) *MapOf[K, V]
The core idea behind is to create generic higher order function that can construct hash func for a specific comparable type.
MakeHashFunc uses some reflection under the hood, but resulting function it produces is very fast zero-allocation hasher that's based on some unsafe magic (the same way as hashers that already exist in this package).
This pull request adds a fast generic hash functions that can be used in MapOf. This allowed to make two new constructors that do not require user to specify hash function manually
The core idea behind is to create generic higher order function that can construct hash func for a specific comparable type.
MakeHashFunc uses some reflection under the hood, but resulting function it produces is very fast zero-allocation hasher that's based on some unsafe magic (the same way as hashers that already exist in this package).
Below are the becnhmarks for different types