I performed a slightly different series of hash table benchmarks including khash — maybe those will interest you: https://hpjansson.org/blag/2018/07/24/a-hash-table-re-hash/

The lessons from those allowed me to improve GHashTable to a point where it’s quite competitive for a general-use hash table: https://hpjansson.org/blag/2018/08/29/what-ails-ghashtable/

Good work on khash — it’s simple, compact, frugal and very fast.

]]>A drawback of all these open addressing schemes is that the number of stored entries cannot exceed the number of slots in the bucket array. In fact, even with good hash functions, their performance dramatically degrades when the load factor grows beyond 0.7 or so. For many applications, these restrictions mandate the use of dynamic resizing, with its attendant costs.

I’m interesting in keeping an existence-only style table of pointer keys (i.e. I only care if the pointer is in the table, not what it’s value is). I want to implement a clone() type function generator using this. Is khash/open addressing suitable?

]]>I made a hashmap too and while being around 2x slower than khash it uses about 25% less memory. I could easily fit in a realloc into my hashmap implementation, but not all data is relocatable and c++ allocators don’t support relocation therefore it’s kind of cheating and that’s why it’s sadly not there, but let me know if you’re interested!

https://github.com/1ykos/ordered_patch_map ]]>