-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove redundant Modulus operation for Voxel Hash function #358
Conversation
…d::floor to have explicit control over type casting
Pull this to fix the CI :)
… map params instead
Can you please give some pointers to the documentation where this can be found? Especially that the modulus operation is done on the hash map side |
The Hashing functionThe modulus operation in the hashing operator of the custom hash function is actually not required by the Robin Map implementation. They perform that operation internally based on the current bucket size, which keeps on changing based on current load_factor of the hash table. See the figure below where I backtrace to that modulus operation in Robin Map library. In fact, the current bucket size that we have, through the hash operator, is 2^20 buckets. This can cause an issue, when internally the robin map grows to more than 2^20 buckets, in which case our hash function will limit the robin map bucket computation. Otherwise, when the internal bucket size is below 2^20, our additional modulus operation is just redundant. |
Default load factor paramsThe robin map internally resizes the hash table based on the load_factor thresholds.
It is better if we already initialize the robin map with a sufficient bucket size, along with increasing the maximum load factor threshold for upscaling to 0.75. This will avoid frequent rehashing of the map, especially at the beginning of any sequence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic @saurabh1002 thanks !
(1 << 20) - 1 & <hash>
from the custom Hashing operator.2. Initialize the robin map with a higher bucket size, change the default load factors.#359Description by Gupta
The modulus operation in the hashing operator of the custom hash function is actually not required by the Robin Map implementation. They perform that operation internally based on the current bucket size, which keeps on changing based on current load_factor of the hash table. See the figure below where I backtrace to that modulus operation in Robin Map library.
In fact, the current bucket size that we have, through the hash operator, is 2^20 buckets. This can cause an issue, when internally the robin map grows to more than 2^20 buckets, in which case our hash function will limit the robin map bucket computation. Otherwise, when the internal bucket size is below 2^20, our additional modulus operation is just redundant.