Live data from Hacker News

A C++ implementation of a fast hash map and hash set using hopscotch hashing

github.com

21–26 of 26 posts

Re: A C++ implementation of a fast hash map and hash set using hopscotch hashing

#21
post #15

My goto these days (and afaik the state of the art) is boost::unordered_flat_set paired with rapidhash for hashing (since the GNU std::hash functions based on murmurhash are ridiculously slow) The cacheline performance is pretty hard to beat (SIMD optimised linear scan before hopping), which is where all the wins come in the real world. But basically any of the faster hash maps from absl, boost or folly are going to…

> with rapidhash for hashing (since the GNU std::hash functions based on murmurhash are ridiculously slow) Doesn't boost::unordered_flat_map use boost::hash by default? How does it compare to rapid hash and std::hash?

It's not great.

Rapidhash is just insanely fast and provides good distribution, with built-in support for mixing.

Re: A C++ implementation of a fast hash map and hash set using hopscotch hashing

#22
post #21

Earlier quoted context omitted.

> with rapidhash for hashing (since the GNU std::hash functions based on murmurhash are ridiculously slow) Doesn't boost::unordered_flat_map use boost::hash by default? How does it compare to rapid hash and std::hash?

It's not great. Rapidhash is just insanely fast and provides good distribution, with built-in support for mixing.

That's good to know, thanks!

Re: A C++ implementation of a fast hash map and hash set using hopscotch hashing

#23

Ah, hopscotch hash, I tried using it on my CSGO cheat literally 10 years ago, for the object reflection (retrospection) system based on compiler type ID and unique hashing scheme with function signature. I merely used it for hopefully getting a performance on the "dependency injection" side of things, until I realized it is actually a service locator pattern and performance won't improve due to this architecture anyw…

> my CSGO cheat

Why would you openly admit this?

Re: A C++ implementation of a fast hash map and hash set using hopscotch hashing

#24

Ah, hopscotch hash, I tried using it on my CSGO cheat literally 10 years ago, for the object reflection (retrospection) system based on compiler type ID and unique hashing scheme with function signature. I merely used it for hopefully getting a performance on the "dependency injection" side of things, until I realized it is actually a service locator pattern and performance won't improve due to this architecture anyw…

> my CSGO cheat Why would you openly admit this?

I learned C++ because of it, what's so shame about it?

Re: A C++ implementation of a fast hash map and hash set using hopscotch hashing

#25
post #15

My goto these days (and afaik the state of the art) is boost::unordered_flat_set paired with rapidhash for hashing (since the GNU std::hash functions based on murmurhash are ridiculously slow) The cacheline performance is pretty hard to beat (SIMD optimised linear scan before hopping), which is where all the wins come in the real world. But basically any of the faster hash maps from absl, boost or folly are going to…

I tried both unordered_flat_map and hopscotch map with the pathfinding algorithm that my game uses. Both were slower than regular unordered_map. unordered_flat_map about 33% slower and hopscotch was 390% slower

Re: A C++ implementation of a fast hash map and hash set using hopscotch hashing

#26

Ah, hopscotch hash, I tried using it on my CSGO cheat literally 10 years ago, for the object reflection (retrospection) system based on compiler type ID and unique hashing scheme with function signature. I merely used it for hopefully getting a performance on the "dependency injection" side of things, until I realized it is actually a service locator pattern and performance won't improve due to this architecture anyw…

> my CSGO cheat Why would you openly admit this?

why do you care?
Post reply on HN