Re:Hacking the Golang Runtime with Genereics
by barsonme on Wednesday December 21, 2022 @03:10AM
(#34077967)
The maphash package from the blog post provides routines that call into Go's runtime to hash arbitrary types.
The maphash package in the standard library (hash/maphash) provides routines that hash string and []byte.
The builtin map type is a hash table.
Re:Hacking the Golang Runtime with Genereics
by shp0ngle on Wednesday December 21, 2022 @12:24PM
(#34083543)
Ahh I somehow misread the post and thought it’s a generic map that uses hash table.
I should get some sleep, thanks
Re:Hacking the Golang Runtime with Genereics
by AaronFriel on Wednesday December 21, 2022 @03:12AM
(#34077980)
Maphash is a library for computing hashes of arbitrary types in Go, not a map data structure.
Re:Hacking the Golang Runtime with Genereics
by codesniperjoe on Thursday December 22, 2022 @09:30AM
(#34093584)
Maphash is an (non-cryptographic-secure) hash function, like CRC32 / CRC64 / XXH3-64 and others, so it turns data in an (almost) uniq uint64.
The main difference is, it is an hardware accelerated & optimized compiler function, now exposed via the new maphash package in stdlib.
And it is fast. Faster than the former performance leader xxh3(avx2/avx512).
Try maphash yourself (example data dedupliction) https://news.ycombinator.com/item?id=34091206
I am surely missing something. I thought the builtin map used hashing too?