martinus / robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
https://gitter.im/martinus/robin-hood-hashing
MIT License
1.5k stars 142 forks source link

Implement single lookup try_emplace POC #114

Closed GilesBathgate closed 3 years ago

GilesBathgate commented 3 years ago

@martinus This is just an idea to implement single call to hash / keyToIdx when invoking try_emplace. Obviously needs work, but is it even right conceptually?

martinus commented 3 years ago

Hi, sorry for the late reply! I had a look at the try_emplace and also insert_or_assign too, which were implemented with two lookups as well. I'm trying to reduce the code duplication that's already present.

GilesBathgate commented 3 years ago

@martinus Yes I can make a PR that removes the code duplication if you like, I just need some help getting the POC right.

martinus commented 3 years ago

I have an implementation in #116 that I'd like to merge. This fixes all two-lookup problems. I hope you don't mind that I don't use your PR!

martinus commented 3 years ago

fixed in #116