Get the latest tech news

Fibonacci Hashing: The Optimization That the World Forgot


I recently posted a blog post about a new hash table, and whenever I do something like that, I learn at least one new thing from my comments. In my last comment section Rich Geldreich talks about h…

Other tables, like google::dense_hash_map also use a power of two hash size to get the fast integer modulo, but it doesn’t provide it’s own implementation of std::hash<int> (because it can’t) so you have to be real careful about your upper bits when using dense_hash_map. I googled a lot for this problem thinking “surely somebody must have a good method for bringing a large number into a small range” but everybody was either doing slow or bad things. I don’t know of a proper test like the avalanche analysis for hash functions, but my first attempt at a definition for “good” would be that every value in the smaller range is equally likely to occur.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of World

World

Photo of optimization

optimization

Related news:

News photo

World's First Wireless Bionic Arm Can Crawl Around On Its Own

News photo

Smishing Triad: The Scam Group Stealing the World’s Riches

News photo

Fake images that fooled the world