Skip to content

Comment on Hash tablesparent

Comments

Those benchmarks are for hashing data in the billions of bytes range. Hash tables typically use data in the 1-20 byte range. Pretty big difference!

As it turns out, hash functions optimized for billions of bytes don't work so well when you use them on only a few bytes. There's just too much startup time and too many irrelevant branches and too much bloat for the icache to handle. That's why most hash tables use simpler algorithms like FNV1A or SipHash, which are faster for small data.

Those benchmarks are for hashing data in the billions of bytes range. Hash tables typically use data in the 1-20 byte range.

No, you misunderstood the purpose of the project. From the benchmarks, SipHash:

   Small key speed test -    1-byte keys -   110.91 cycles/hash
   Small key speed test -    2-byte keys -   110.32 cycles/hash
   ...
   Small key speed test -   20-byte keys -   164.79 cycles/hash
wyhash:
   Small key speed test -    1-byte keys -    18.00 cycles/hash
   Small key speed test -    2-byte keys -    18.00 cycles/hash
   ...
   Small key speed test -   20-byte keys -    21.00 cycles/hash
The whole purpose of smhasher is to help choose hash functions for hash tables and alike implementations.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.