Fnv hasher: small keys


#1

It is said the the fnv hasher is more efficient for smaller hash keys.

What is a small key? Of course, I regard an int as a small key. But where does small end? I don’t expect a specific number. So some rule of thumb would be good enough.

Thanks.


#2

Its docs have a link to some experiments: http://cglab.ca/~abeinges/blah/hash-rs/

As a rule of thumb, you could consider <=20 bytes as “small”. But if hashing is important to your case, you should benchmark with your data corpus to make sure.


#3

Thanks a lot. That link is very interesting.

In my case I use a key (u64,u64). The data is not very large. So, fnv is perfect for my use case.