Skip to content

Experiment with lazy allocation for empty DenseBitSet storage#157024

Draft
Jamesbarford wants to merge 1 commit into
rust-lang:mainfrom
Jamesbarford:experiment/bitset-perf
Draft

Experiment with lazy allocation for empty DenseBitSet storage#157024
Jamesbarford wants to merge 1 commit into
rust-lang:mainfrom
Jamesbarford:experiment/bitset-perf

Conversation

@Jamesbarford
Copy link
Copy Markdown
Contributor

Looking at; github.com//pull/141325/changes#diff-97fbe92bf4d0e17d698ec0b8f45cd215786376572a51a36b641f84c66dc2281f and seeing what impact a naive implementation of lazily instantiating the Vector backed storage has on performance.

r? @ghost

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 27, 2026
@Jamesbarford
Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 27, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 27, 2026
Experiment with lazy allocation for empty DenseBitSet storage
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_span test:true 11.338
   Compiling rustc_fs_util v0.0.0 (/checkout/compiler/rustc_fs_util)
[RUSTC-TIMING] rustc_fs_util test:true 0.189
   Compiling rustc_index v0.0.0 (/checkout/compiler/rustc_index)
error[E0277]: the trait bound `i32: idx::Idx` is not satisfied
    --> compiler/rustc_index/src/bit_set/tests.rs:103:52
     |
 103 |     assert_eq!(matrix.words().len(), 3 * num_words(130));
     |                                          --------- ^^^ the trait `idx::Idx` is not implemented for `i32`
     |                                          |
     |                                          required by a bound introduced by this call
     |
help: the following other types implement trait `idx::Idx`
    --> compiler/rustc_index/src/idx.rs:26:1
     |
  26 | impl Idx for usize {
     | ^^^^^^^^^^^^^^^^^^ `usize`
...
  37 | impl Idx for u32 {
     | ^^^^^^^^^^^^^^^^ `u32`
note: required by a bound in `bit_set::num_words`
    --> compiler/rustc_index/src/bit_set.rs:1815:17
     |
1815 | fn num_words<T: Idx>(domain_size: T) -> usize {
     |                 ^^^ required by this bound in `num_words`

For more information about this error, try `rustc --explain E0277`.
[RUSTC-TIMING] rustc_index test:true 1.012
error: could not compile `rustc_index` (lib test) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 27, 2026

☀️ Try build successful (CI)
Build commit: 4731326 (473132651821eed122d82a410428d80aa10a47fa, parent: ddc1a64229890506f57bae5b270f9e5f604294ec)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (4731326): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking 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.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.3%] 8
Regressions ❌
(secondary)
0.4% [0.2%, 1.0%] 14
Improvements ✅
(primary)
-0.3% [-0.4%, -0.2%] 6
Improvements ✅
(secondary)
-0.2% [-0.4%, -0.0%] 17
All ❌✅ (primary) -0.0% [-0.4%, 0.3%] 14

Max RSS (memory usage)

Results (primary -2.3%, secondary -5.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
-5.7% [-5.7%, -5.7%] 1
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 1

Cycles

Results (primary 2.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.5% [2.5%, 2.5%] 1

Binary size

Results (secondary 0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 510.991s -> 512.432s (0.28%)
Artifact size: 400.76 MiB -> 400.67 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants