-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
crypto/types: optimize compact bit array one count #9216
crypto/types: optimize compact bit array one count #9216
Conversation
cc @odeke-em |
Codecov Report
@@ Coverage Diff @@
## master #9216 +/- ##
==========================================
- Coverage 60.12% 60.12% -0.01%
==========================================
Files 595 595
Lines 37190 37188 -2
==========================================
- Hits 22361 22359 -2
Misses 12848 12848
Partials 1981 1981
|
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.
utACK
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.
let's clean the inner loop
CI fails because of #9010, |
By using bits.OnesCount8 instead of bitwise operations. Benchmark result on Apple M1: name old time/op new time/op delta NumTrueBitsBefore/new-8 88.5ns ± 1% 9.1ns ± 0% -89.68% (p=0.000 n=10+10) name old alloc/op new alloc/op delta NumTrueBitsBefore/new-8 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta NumTrueBitsBefore/new-8 0.00 0.00 ~ (all equal) Fixes #9125
Kindly ping @robert-zaremba @odeke-em |
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.
Thanks, good improvement, and code reduction !
Ops, wrong issue reference, should be #9215 |
Description
By using bits.OnesCount8 instead of bitwise operations.
Benchmark result on Apple M1:
Fixes #9125
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes