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

Adds iter_ones() to RollingBitField #33956

Merged

Conversation

brooksprumo
Copy link
Contributor

Problem

During shrink, we are given a set of 'candidate slots' to inspect. Currently, these candidates are a HashSet (with the nohash-hasher). To make this faster, we can change the ShrinkCandidates to a RollingBitField. However, RollingBitField does not have a method to iterate over the set bits, so this means we would have to create a Vec of all the set bits, even though we don't need the Vec.

It would be better to avoid this unnecessary allocation, and instead just iterate the set bits.

Summary of Changes

Add iter_ones() to RollingBitField.

@brooksprumo brooksprumo self-assigned this Nov 6, 2023
@brooksprumo brooksprumo marked this pull request as ready for review November 6, 2023 17:27
Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #33956 (186fd44) into master (a4a6602) will increase coverage by 0.0%.
Report is 8 commits behind head on master.
The diff coverage is 91.8%.

@@           Coverage Diff           @@
##           master   #33956   +/-   ##
=======================================
  Coverage    81.9%    81.9%           
=======================================
  Files         809      810    +1     
  Lines      218447   218484   +37     
=======================================
+ Hits       178942   179022   +80     
+ Misses      39505    39462   -43     

Copy link
Contributor

@HaoranYi HaoranYi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@brooksprumo brooksprumo merged commit 70d97d3 into solana-labs:master Nov 6, 2023
43 checks passed
@brooksprumo brooksprumo deleted the rolling-bit-field/ones-iter branch November 6, 2023 19:06
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

Successfully merging this pull request may close these issues.

2 participants