Billion-query-per-second lookup tables in C++

lemire.me

13 points by foltik 8 hours ago


Panzerschrek - an hour ago

> How do we find the association values? We sort the characters by how many keys they touch. We then take them one at a time and try 0, 1, 2, … until we find a value that does not cause a collision.

This sounds too easy to be true. As I understand, that's the core of the whole approach - to find a table filled with some magic values giving perfect hashing. And it shouldn't be that simple, since search space is huge (a table with 256-values each with 8 bits size at least).

Panzerschrek - 4 hours ago

Nice approach. I hope some time compilers will eventually learn to detect code containing a bunch of if-else with string comparison and replace it with perfect hashing.