Skip to content

Use excess allocation for RawVec - #165787

Draft
clarfonthey wants to merge 1 commit into
rust-lang:mainfrom
clarfonthey:raw-vec-excess
Draft

clarfonthey wants to merge 1 commit into
rust-lang:mainfrom
clarfonthey:raw-vec-excess

Conversation

@clarfonthey

@clarfonthey clarfonthey commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

I'm sure someone else has done this but the difference here is I'm doing this and therefore we should expect different results.

Mostly exists to run perf.

@clarfonthey clarfonthey added the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Nov 10, 2026
@rustbot rustbot added A-rawvec Area: `RawVec<T>` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 10, 2026
@clarfonthey clarfonthey added the A-allocators Area: Custom and system allocators label Nov 10, 2026
@clarfonthey

This comment was marked as outdated.

@rust-timer

This comment was marked as outdated.

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 10, 2026
@rust-log-analyzer

This comment was marked as outdated.

@rust-bors

This comment was marked as outdated.

@clarfonthey

This comment was marked as outdated.

@rust-timer

This comment was marked as outdated.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 10, 2026
@rust-log-analyzer

This comment has been minimized.

@clarfonthey

This comment was marked as outdated.

@rust-timer

This comment was marked as outdated.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 11, 2026
@rust-log-analyzer

This comment has been minimized.

@clarfonthey

Copy link
Copy Markdown
Contributor Author

@bors try
@rust-timer queue

perseverance

@rust-timer

This comment was marked as outdated.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 11, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 92b9828 (92b98285de49a88618e3496332e83280acc0a67f)
Base parent: 9c56488 (9c5648833e5ceb667a708d53c00b83ecc9e610d5)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (92b9828): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

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=iffy rustc-perf
@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.3% [0.1%, 0.3%] 10
Regressions ❌
(secondary)
0.3% [0.1%, 0.4%] 11
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-0.6% [-0.6%, -0.6%] 1
All ❌✅ (primary) 0.2% [-0.6%, 0.3%] 11

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (primary 2.7%, 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.7% [2.3%, 3.1%] 3
Regressions ❌
(secondary)
2.6% [2.2%, 3.0%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.7% [2.3%, 3.1%] 3

Binary size

Results (primary 0.2%, 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.2% [0.0%, 2.0%] 26
Regressions ❌
(secondary)
0.1% [0.0%, 2.0%] 89
Improvements ✅
(primary)
-0.0% [-0.1%, -0.0%] 3
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 3
All ❌✅ (primary) 0.2% [-0.1%, 2.0%] 29

Bootstrap: 482.775s -> 482.718s (-0.01%)
Artifact size: 406.47 MiB -> 406.42 MiB (-0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 11, 2026
@rust-log-analyzer

This comment has been minimized.

@clarfonthey

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 Nov 11, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 11, 2026
@rust-bors

This comment has been minimized.

@clarfonthey

Copy link
Copy Markdown
Contributor Author

@bors retry

@rust-bors

rust-bors Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

❗ You can only retry pull requests that are approved and have a previously failed auto build.

Hint: If you wanted to retry pull request CI instead, push the latest commit again, or close and then reopen this PR.

@clarfonthey

Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 11, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Diff in /checkout/library/alloc/src/raw_vec/mod.rs:799:
         // SAFETY: We wouldn't be able to allocate something larger than an isize,
         // and we don't allocate for ZSTs here.
         unsafe {
-            Cap::new_unchecked(if intrinsics::is_val_statically_known(size) || size.is_power_of_two() {
-                intrinsics::unchecked_div(ptr.len(), elem_layout.size())
-            } else {
-                capacity
-            })
+            Cap::new_unchecked(
+                if intrinsics::is_val_statically_known(size) || size.is_power_of_two() {
+                    intrinsics::unchecked_div(ptr.len(), elem_layout.size())
+                } else {
+                    capacity
+                },
+            )
         }

@rust-bors

rust-bors Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 22b2d15 (22b2d157473201fa344831f7ecd1184897f08db1)
Base parent: 9c56488 (9c5648833e5ceb667a708d53c00b83ecc9e610d5)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (22b2d15): comparison URL.

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

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

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=iffy rustc-perf
@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.3% [0.1%, 0.4%] 22
Regressions ❌
(secondary)
0.4% [0.2%, 0.4%] 7
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.2%] 2
All ❌✅ (primary) 0.2% [-0.5%, 0.4%] 23

Max RSS (memory usage)

Results (primary 2.1%, secondary 2.3%)

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

Cycles

Results (secondary 6.5%)

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)
6.5% [6.5%, 6.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
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.2% [0.0%, 2.0%] 42
Regressions ❌
(secondary)
0.1% [0.0%, 2.0%] 95
Improvements ✅
(primary)
-0.1% [-0.1%, -0.0%] 5
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 2
All ❌✅ (primary) 0.1% [-0.1%, 2.0%] 47

Bootstrap: 482.775s -> 482.119s (-0.14%)
Artifact size: 406.47 MiB -> 406.41 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocators Area: Custom and system allocators A-rawvec Area: `RawVec<T>` perf-regression Performance regression. S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library 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