-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Regression: hash([1,2,[3]]) throws on 0.7 #26011
Labels
domain:arrays
[a, r, r, a, y, s]
domain:hashing
kind:bug
Indicates an unexpected problem or unintended behavior
kind:regression
Regression in behavior compared to a previous version
Comments
StefanKarpinski
added
domain:arrays
[a, r, r, a, y, s]
kind:bug
Indicates an unexpected problem or unintended behavior
labels
Feb 12, 2018
#25822 is one way of fixing this. |
JeffBezanson
added
the
kind:regression
Regression in behavior compared to a previous version
label
Feb 14, 2018
KristofferC
pushed a commit
that referenced
this issue
Feb 11, 2019
Goal: Hash approximately log(N) entries with a higher density of hashed elements weighted towards the end and special consideration for repeated values. Colliding hashes will often subsequently be compared by equality -- and equality between arrays works elementwise forwards and is short-circuiting. This means that a collision between arrays that differ by elements at the beginning is cheaper than one where the difference is towards the end. Furthermore, blindly choosing log(N) entries from a sparse array will likely only choose the same element repeatedly (zero in this case). To achieve this, we work backwards, starting by hashing the last element of the array. After hashing each element, we skip the next `fibskip` elements, where `fibskip` is pulled from the Fibonacci sequence -- Fibonacci was chosen as a simple ~O(log(N)) algorithm that ensures we don't hit a common divisor of a dimension and only end up hashing one slice of the array (as might happen with powers of two). Finally, we find the next distinct value from the one we just hashed. Fixes #27865 and fixes #26011. Fixes #26034
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
domain:arrays
[a, r, r, a, y, s]
domain:hashing
kind:bug
Indicates an unexpected problem or unintended behavior
kind:regression
Regression in behavior compared to a previous version
Works fine on Julia Version 0.6.2 Commit d386e40 (2017-12-13 18:08 UTC).
The text was updated successfully, but these errors were encountered: