Skip to content
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: compact bit array one count is not optimal #9215

Closed
4 tasks
cuonglm opened this issue Apr 28, 2021 · 1 comment
Closed
4 tasks

crypto/types: compact bit array one count is not optimal #9215

cuonglm opened this issue Apr 28, 2021 · 1 comment

Comments

@cuonglm
Copy link
Contributor

cuonglm commented Apr 28, 2021

Summary

Optimize CompactBitArray.NumTrueBitsBefore.

Problem Definition

Currently, CompactBitArray.NumTrueBitsBefore perform a loop and test bit set using bitwise:

if (bA.Elems[elem]>>b)&1 == 1 {

It can be faster, by taking advantage of hardware supports.

Proposal

Instead of doing bitwise, using standard bits.OnesCount8.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@cuonglm
Copy link
Contributor Author

cuonglm commented May 4, 2021

Fixed after #9216

@cuonglm cuonglm closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant