Skip to content

[EXPERIMENT] RawBitSet experiments#153589

Draft
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:bit-set
Draft

[EXPERIMENT] RawBitSet experiments#153589
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:bit-set

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Mar 9, 2026

View all comments

(Doing some perf runs to see if I'm on the right track with this RawBitSet stuff.)

@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 Mar 9, 2026
@Zalathar
Copy link
Member Author

Zalathar commented Mar 9, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 9, 2026
[EXPERIMENT] RawBitSet experiments
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 9, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 9, 2026

☀️ Try build successful (CI)
Build commit: 524f8f3 (524f8f327bef00d806aadab2c3f1cf6d424c6f5a, parent: b41f22de2a13a0babd28771e96feef4c309f54aa)

@rust-timer

This comment has been minimized.

@lqd
Copy link
Member

lqd commented Mar 9, 2026

If you’re working on bitsets, it could be cool to take a look at #141325 and bring that to completion. It was a nice win and the author doesn’t have the time to rebase, and finish it.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (524f8f3): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.1% [0.1%, 0.1%] 2
Regressions ❌
(secondary)
0.6% [0.0%, 1.1%] 11
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 2
Improvements ✅
(secondary)
-0.2% [-0.4%, -0.1%] 18
All ❌✅ (primary) -0.1% [-0.3%, 0.1%] 4

Max RSS (memory usage)

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

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)
-5.7% [-10.3%, -1.1%] 2
Improvements ✅
(secondary)
-1.1% [-1.1%, -1.1%] 1
All ❌✅ (primary) -5.7% [-10.3%, -1.1%] 2

Cycles

Results (secondary 3.2%)

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)
3.2% [3.2%, 3.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 478.517s -> 499.35s (4.35%)
Artifact size: 395.02 MiB -> 395.00 MiB (-0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 9, 2026
@Zalathar
Copy link
Member Author

Zalathar commented Mar 9, 2026

If you’re working on bitsets, it could be cool to take a look at #141325 and bring that to completion. It was a nice win and the author doesn’t have the time to rebase, and finish it.

One of my ambitions is to eventually allow a large subset of bitsets to allocate their word storage in a dropless arena (either a local arena or the one in TyCtxt), which could potentially cut down on a lot of allocation bookkeeping.

@Zalathar
Copy link
Member Author

Zalathar commented Mar 9, 2026

Let's make sure a simpler RawBitSet is perf-neutral, before trying to make ambitious changes.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 9, 2026
[EXPERIMENT] RawBitSet experiments
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 9, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 9, 2026

☀️ Try build successful (CI)
Build commit: 1eba61e (1eba61e69a9a8e83369894aef1ff64dd0b8e66b2, parent: 98e7077b903559d7a4fafb775cd5292cc9427b67)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1eba61e): comparison URL.

Overall result: ❌ regressions - please read the text below

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

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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%] 3
Regressions ❌
(secondary)
0.2% [0.0%, 0.3%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.1%, 0.3%] 3

Max RSS (memory usage)

Results (primary 2.4%)

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

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

Cycles

Results (primary 2.0%, secondary -2.6%)

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

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-3.0%, -2.1%] 2
All ❌✅ (primary) 2.0% [2.0%, 2.0%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 479.865s -> 479.014s (-0.18%)
Artifact size: 395.05 MiB -> 394.98 MiB (-0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 9, 2026
@Zalathar
Copy link
Member Author

Zalathar commented Mar 9, 2026

Hmm, it's frustrating that the monomorphic RawBitSet isn't perf-neutral, even with #[inline] sprinkled everywhere.

Will #[inline(always)] do the trick?

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 9, 2026
[EXPERIMENT] RawBitSet experiments
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 9, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 9, 2026

☀️ Try build successful (CI)
Build commit: 861e8d4 (861e8d4337f9d836ac906e4daf4a6de867cb24a9, parent: 98e7077b903559d7a4fafb775cd5292cc9427b67)

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 19, 2026

☀️ Try build successful (CI)
Build commit: 0230ff2 (0230ff208d15f10e01eebf4c59feaa427be929f2, parent: fd0c901b00ee1e08a250039cdb90258603497e20)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0230ff2): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking 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
@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
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 4
All ❌✅ (primary) -0.5% [-0.5%, -0.5%] 1

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary 7.8%)

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)
7.8% [7.8%, 7.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 481.003s -> 483.152s (0.45%)
Artifact size: 396.91 MiB -> 395.00 MiB (-0.48%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2026
@Zalathar
Copy link
Member Author

Now let's try extracting insert and remove.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 19, 2026
[EXPERIMENT] RawBitSet experiments
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 19, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 19, 2026

☀️ Try build successful (CI)
Build commit: adfd24b (adfd24b47ef282de3145af0d13534e9164c749dc, parent: 8b86f48958be8c3473c979e0b5504c2d2e0fd4fd)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (adfd24b): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.4%] 9
Regressions ❌
(secondary)
0.2% [0.0%, 0.4%] 16
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 3
All ❌✅ (primary) 0.2% [0.1%, 0.4%] 9

Max RSS (memory usage)

Results (secondary 1.2%)

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)
2.6% [1.9%, 3.0%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary -4.3%)

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)
- - 0
Improvements ✅
(secondary)
-4.3% [-4.3%, -4.3%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.842s -> 481.232s (0.08%)
Artifact size: 395.02 MiB -> 395.01 MiB (-0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 19, 2026
@Zalathar
Copy link
Member Author

Hmm, so extracting insert and remove causes a bunch of small regressions, even though the extracted functions are marked #[inline].

@Zalathar
Copy link
Member Author

Trying a tweaked version of insert/remove that tries even harder to not harm performance.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 20, 2026
[EXPERIMENT] RawBitSet experiments
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 20, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 20, 2026

☀️ Try build successful (CI)
Build commit: d8fcb14 (d8fcb148e3f3a57f477967569c102e768a99a3a9, parent: bcf3d36c997dd9b5db4bb7f40cb91dd4cf46a305)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d8fcb14): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking 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
@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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 3
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.1%, secondary -1.8%)

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

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

Cycles

Results (secondary 3.2%)

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)
3.2% [2.6%, 3.7%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 483.892s -> 482.05s (-0.38%)
Artifact size: 394.73 MiB -> 394.86 MiB (0.03%)

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

Labels

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.

5 participants