fix: remove unnecessary hash calculations #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's the reasoning behind this change? The extra shift and add won't actually be expensive, and I've often seen this pattern (with a bitshift on both values) in simple hash functions.
I don't see the reason why both values are bit shifted. The depth is already bit shifted (<< 0) and the parent just bit shifts to allocate for the maximal depth (in this case, 2^8).
[Edit]: We also need to modulo the parent hash with some prime to truncate for later, but this hash holds for at least 16 or so indents without overflowing.
I don't know a lot about hash functions, but running a simulation on hashing groups of small integers this change increases the amounts of clashes by about 30%, so I don't think it's a good idea.
Pull request closed