- Notifications
You must be signed in to change notification settings - Fork 13.8k
Bitset cleanups #147630
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
base: master
Are you sure you want to change the base?
Bitset cleanups #147630
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
448c48c
to f6ff60b
Compare This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (c78dd25): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -6.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 4.9%, secondary -2.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 474.753s -> 474.463s (-0.06%) |
} | ||
| ||
#[inline] | ||
fn count_ones(words: &[Word]) -> usize { |
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.
Should this return a ChunkSize
directly? It's mostly used to be cast.
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.
If it returns ChunkSize
directly, then it's only correct for slices no larger than a chunk, making it incorrect for DenseBitSet::count
in the general case.
So if the return value is to be changed, it should be extracted to a separate function with a narrower name.
r=me with or without the nit |
words.iter().map(|w| w.count_ones() as ChunkSize).sum::<ChunkSize>(), | ||
count | ||
); | ||
assert_eq!(count_ones(&**words) as ChunkSize, count); |
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.
Nit: Instead of a cryptic &**words
, I typically find it clearer to write something like words.as_slice()
instead.
Some minor cleanups I did while working on #147619.
r? @Zalathar