I opened this post in a tab 3 days ago, but now it says "5 hours ago". Someone is playing around.
No, not really. It's called the second chance pool.
11–20 of 30 posts
I opened this post in a tab 3 days ago, but now it says "5 hours ago". Someone is playing around.
No, not really. It's called the second chance pool.
To summarize: multiplication hashes are inferior but when used with the golden ratio derived integer, they are actually superior
I opened this post in a tab 3 days ago, but now it says "5 hours ago". Someone is playing around.
I h8 it when thir teens get all cheeky like that. Hopefully they'll have matured a bit by 21. Edit: it seems people don't like my Fibonacci joke. I thought I had this kind of thing figured out by 34.
To summarize: multiplication hashes are inferior but when used with the golden ratio derived integer, they are actually superior
Better summary. Fibonacci hashing isn't a great hash function, but it is a really good solution to mapping large integers to small integers. Using it for that doubles the speed of hashing in practice.
This technique is orthogonal to integer mod. Indeed the author multiplies by their magic constant and then does an integer mod to map into their hashtable's buckets.
This technique is actually just applying a fast integer hash on the input keys to the hashtable before mapping the keys to buckets. You can then map to buckets however you want.
The additional hash is useful if and only if the input hash function for your table's keys doesn't appear to be a random function, i.e. it doesn't mix its bits for whatever reason. If your input hash functions are indeed random then this is a (small but perhaps measurable) waste of time.
Using prime-numbered table sizes is another way to accomplish basically the same thing. Dividing the input hash key by a prime forces you to look at all the bits of the input. In practice these are written as division by a constant, so they use multiplies and shifts. It's basically a hash function. (Though I'd use multiply by a magic number over divide by a prime, mul alone should be faster.)
Relatedly see this post by Daniel Lemire about an alternative to integer mod, https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-... which is interesting if your number of buckets is not a power of 2 for some reason.
I think the author has misunderstood things here. This technique is orthogonal to integer mod. Indeed the author multiplies by their magic constant and then does an integer mod to map into their hashtable's buckets. This technique is actually just applying a fast integer hash on the input keys to the hashtable before mapping the keys to buckets. You can then map to buckets however you want. The additional hash is use…
So maybe one way of looking at this is as an efficient fusion operation, which doesn't look special when you look at the ops in isolation, but combine to something that is both fast and advised problems with input patterns.
The youtube video is marked private?