Use Box<[Word]> for word storage in DenseBitSet - #161957
Conversation
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.
|
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:
|
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.