-
Notifications
You must be signed in to change notification settings - Fork 698
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
Better hashing of GraphId #3332
Conversation
@@ -19,6 +19,7 @@ | |||
* FIXED: Make combine_route_stats.py properly quote CSV output (best practice improvement) [#3328](https://github.com/valhalla/valhalla/pull/3328) | |||
* FIXED: Merge edge segment records in map matching properly so that resulting edge indices in trace_attributes are valid [#3280](https://github.com/valhalla/valhalla/pull/3280) | |||
* FIXED: Shape walking map matcher now sets correct edge candidates used in the match for origin and destination location [#3329](https://github.com/valhalla/valhalla/pull/3329) | |||
* FIXED: Better hash function of GraphId [#3332](https://github.com/valhalla/valhalla/pull/3332) |
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.
I'm not sure this should be considered a fix. Probably more of an enhancement but no need to change this change log entry
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.
Specifically in case of robin_hood::unordered_map
this caused a bug (insertion to unordered_map threw an exception), that is why I considered this a bugfix.
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.
I couldn't remember where we used it with that container. Actually in most cases I expected we would send the value directly to the container and let the container worry about hashing it. In other words the container template type would be uint64_t
What problem was this trying to solve? Sorry I couldn't gather much from the description (was the current scheme causing too many collisions?) Would love to have seen some tests demonstrating the fix. |
@mandeepsandhu it works perfectly on 64-bit, but not on 32-bit, because |
@mandeepsandhu
So if we just strip it to 32 bits (the size of |
Issue
https://github.com/martinus/robin-hood-hashing
static_cast<size_t>(k.value)
is not good hashing. Especially in case of 32-bitsize_t
, whenrobin_hood::unordered_map
fails pretty fast.Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?