Now I'm not going to pretend this is super scientific. It's a pretty small sample size, but it's larger than the author used in his article. Integer modulo on a hash tables sized to a power of two benefits from the same optimization as the Fibonacci hash.
-
-
Näytä tämä ketju
-
I guess all I'm saying here is that I'm not convinced fib multiplication is great for getting a bucket index of a hash table. Best I can tell, it has worse distribution. Ideally, the above bar graph is entirely flat. Integer Modulo is closer to that.
Näytä tämä ketju -
Worth mentioning that if I shuffle the random seed, the fib multiplication will occasionally beat out integer modulo. Probably 1/5 times. Again, not scientific, but certainly not inspiring confidence.
Näytä tämä ketju
Keskustelun loppu
Uusi keskustelu -
-
-
Isn't the problem with real data that it's not random but often sequential in chunks? What happens if you feed in 0-1000?
-
I can tell you that sequential numbers times golden ratio gives a low discrepancy output and is roughly even. Random numbers (white noise) times golden ratio gives white noise out - clumps and voids and unevennes. Maybe that's the difference in the tests here.
- Näytä vastaukset
Uusi keskustelu -
-
-
I should clarify the data: it's 1000 random numbers between 0 and 10,000. Here is random between 0 and max 32 bit int, with a few different seeds:pic.twitter.com/MVfZ1Da7sr
Näytä tämä ketju -
I'm using Google Spreadsheet's =RANDBETWEEN function. No idea about it's own distribution qualities. Again, I'm not going to say this is extremely scientific or exhaustive. Just interesting to see it break down in various cases.
Näytä tämä ketju
Keskustelun loppu
Uusi keskustelu -
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.