Lessons from Hash Table Merging

9 points by knl


fanf

This is roughly the same bug that the old Rust Robin Hood hash table suffered nearly a decade ago, where reinsertion was accidentally quadratic.

osa1

If you're adding N elements to a hash map you should just grow it first (i.e. solution 2 in the post). You should do it regardless of the other things you do (solutions 1 and 3), you should do it always.

And once you do that the problem will disappear and you may not need solutions 1 and 3.