-
-
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
hash_uint: simplify definitions #36120
base: master
Are you sure you want to change the base?
Conversation
base/hashing.jl
Outdated
# random constants, first must be odd | ||
a = (0xafa64689f53d9ee1 % T) * ((0xcb9de6b205c9c1e2 % T) ⊻ n) | ||
b = (0xe391e8b4ff155ee5 % T) + ((0xb9d8ebf206d49927 % T) ⊻ n) | ||
c = a ⊻ b # bitrotate(a, 43) ⊻ bitrotate(b, -17) |
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.
c = a ⊻ b # bitrotate(a, 43) ⊻ bitrotate(b, -17) | |
c = a ⊻ b |
d9c89c9
to
d27be66
Compare
Not sure if this is worth all the doctest churn. On the other hand, it's kind of bad that so many doctests depend on the internals of hashing. Another argument for ordered dicts... |
It's worse than that though, the doctests also depend on the internals of |
Why? We can just update them whenever needed. It's a single command to do it. It's not different from any other case where we slightly tweak the printing and then have to fix up the doctests. |
We could do that, too, but changing the doctests whenever the computed result don't fit with the documentation does sort of defeat the purpose of doc-tests. Ideally, they should only be updated if the documented behaviour changes. Of course, changes to the documentation itself or printing will necessitate updating the docs, so that is an exception. |
No, it doesn't. The point of a doctest is to ensure that the examples in the documentation looks roughly correct, and don't become outdated as changes accumulate. A doctest will by itself never block a change from going in, it can just serve as a hint/warning of how a change affects the printing of stuff. If it still looks ok from a manual look then the doctest is just updated. This happens pretty much all the time. |
+1 for simplifying the core hash logic |
This seems worth reviving given the potential performance implications. |
Experimenting with simplifying and slightly speeding up
hash_uint
.