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)

@Zalathar
Copy link
Member Author

@bors try cancel
@bors try

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 18, 2026

Try build cancelled. Cancelled workflows:

rust-bors bot pushed a commit that referenced this pull request Mar 18, 2026
[EXPERIMENT] RawBitSet experiments
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 18, 2026

☀️ Try build successful (CI)
Build commit: 91b0728 (91b0728978be01cf1e6b714faffe2d86b6d15a6c, parent: a3903b1e6f699ebe3662da79bd4a63bd699a3fea)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (91b0728): comparison URL.

Overall result: ❌ regressions - 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.2% [0.1%, 0.3%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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

Cycles

Results (secondary 1.9%)

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.7% [3.4%, 4.0%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-3.5%, -3.5%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.1%, secondary 0.1%)

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

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.2%] 45
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 23
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.2%] 45

Bootstrap: 481.409s -> 480.983s (-0.09%)
Artifact size: 394.92 MiB -> 394.91 MiB (-0.00%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Mar 18, 2026
@Zalathar Zalathar force-pushed the bit-set branch 2 times, most recently from 6b79202 to 3cbadec Compare March 19, 2026 07:28
@Zalathar
Copy link
Member Author

Now let's also extract the bodies of methods that use RangeBounds.

@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-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@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
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 19, 2026

⌛ Trying commit 974f59e with merge adfd24b

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/23291375280

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
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. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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