Use Box<[Word]> for word storage in DenseBitSet - #161957
Conversation
|
cc @panstromek @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.
Use `Box<[Word]>` for word storage in `DenseBitSet`
|
For future work, we could potentially shrink |
This comment has been minimized.
This comment has been minimized.
|
Nice, I was going to try this one too, it should help cases when we store As I was looking at the usages of these (DenseBitSets in Vecs, SparseBitMatrix), I found that they are often not quite optimally used anyway, so it might be better to just eliminate them, so I did one in #161850 and I think we can eliminate other ones too. That might reduce the impact of this PR, but we still probably have a ton of BitSets in other places where it'll help. |
|
Finished benchmarking commit (cfa61c7): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never rustc-perf 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 2.6%, secondary 1.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.3%, secondary 4.1%)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.378s -> 479.269s (1.03%) |
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors r+ rollup |
|
This has known perf impact, so let's not roll it up. @bors rollup=never |
|
The bors config at |
This code only uses `GrowableBitSet` as a way to resize a `DenseBitSet` while retaining its values.
…ine` This code appears to only need a variation of `DenseBitSet::contains` that doesn't panic on out-of-domain values.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Rebased. @bors r=chenyukang |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing eca445e (parent) -> 55c4dfe (this PR) Test differencesShow 4 test diffsStage 0
Stage 1
Additionally, 2 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 55c4dfed758e741620e3320ed472ff5c4140856a --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (55c4dfe): comparison URL. Overall result: ❌✅ regressions and improvements - no action needed@rustbot label: -perf-regression 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 -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -0.1%, secondary 6.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 481.923s -> 480.775s (-0.24%) |
|
This is quite interesting, the win is much smaller now. Since this PR was first measured, we landed a few other optimizations in places where Still a win though,
|
|
And regardless of the perf outcome, I'm happy to have disconnected |
View all comments
Since
DenseBitSethas a fixed domain size, it doesn't need the capacity field ofVec. This shrinks the inline-size ofDenseBitSetfrom 32 bytes to 24 bytes.The main reason this wasn't done earlier is that
GrowableBitSetdoes require resizing, and was usingDenseBitSetas its internal representation.Thus, most of this PR is separating the two bitset implementations, so that
DenseBitSetis free to use a more appropriate storage type.