Hacker News new | ask | show | jobs
by Xk 5757 days ago
Looks like a case of premature optimization to me. Optimizing for hash function speed when you end up with thousands of comparisons is just pathetic. Who cares if your hash function takes a whole millisecond instead of a fraction of a millisecond if it ends up that you get an equal distribution in the different buckets?

(On average they're going to need to compare with 6324 other objects before they've gotten the right one. A perfect hash function would end up 5686 checks. Willing to bet that the 639 fewer checks would make up for a better hash function.)

But that's just the beginning of the problem! I mean, even with a hash function that's that bad, ~100 buckets would get them nearly 10X better performance! And realistically, why not use several thousand buckets? Come on ...

1 comments

This is used for everything in his environment, and has been for 20 years or so. The Odb. Local hash variables, stack frames. Both speed and size wewe important when this was created. Why it's coming up now, I have no idea.