-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Allow non-power-of-2 signature cache sizes #9533
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
Conversation
|
Concept ACK. Great find! |
|
Travis failure is in keypool.py, so seemingly unrelated. |
| (uint32_t)((hash_function.template operator()<4>(e) * (uint64_t)size) >> 32), | ||
| (uint32_t)((hash_function.template operator()<5>(e) * (uint64_t)size) >> 32), | ||
| (uint32_t)((hash_function.template operator()<6>(e) * (uint64_t)size) >> 32), | ||
| (uint32_t)((hash_function.template operator()<7>(e) * (uint64_t)size) >> 32)}}; |
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.
maybe a small inline function/macro would be easier to read than this?
|
utACK. |
|
someone should make sure to benchmark this change. |
|
Just dropping a note here to assist other reviewers that you should also verify that |
|
Anything needed here? |
|
Maybe a benchmark? I'd previously done a simulation on division v.s. masking and didn't see a difference, so I'm sure that this is fine... |
|
utACK |
7482781 Allow non-power-of-2 signature cache sizes (Pieter Wuille) Tree-SHA512: 5731c22b46c5ae81cf6d52000c28e39b243a47d96d91079942a5b5a10db214449217f71aa2195e18f8a3917cb206b04c75dc13e4522eb700a1dbf1819013ba22
7482781 Allow non-power-of-2 signature cache sizes (Pieter Wuille) Tree-SHA512: 5731c22b46c5ae81cf6d52000c28e39b243a47d96d91079942a5b5a10db214449217f71aa2195e18f8a3917cb206b04c75dc13e4522eb700a1dbf1819013ba22
This uses the fast reduction from http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ instead of a modulus operator to quickly compute (nearly) uniformly distributed values within range.