Skip to content

Comments

Just pass Layout directly to box_new_uninit#152737

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
scottmcm:box_new_uninit_layout
Feb 22, 2026
Merged

Just pass Layout directly to box_new_uninit#152737
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
scottmcm:box_new_uninit_layout

Conversation

@scottmcm
Copy link
Member

@scottmcm scottmcm commented Feb 17, 2026

View all comments

We have a constant for it already (used in RawVec for basically the same polymorphization) so let's use it.

This is a simple follow-up to #148190 from one of the comments.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 17, 2026
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, joboet

@scottmcm
Copy link
Member Author

Since we saw this code is perf-sensitive, to make sure it doesn't blow up...
@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 Feb 17, 2026
Just pass `Layout` directly to `box_new_uninit`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 17, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

☀️ Try build successful (CI)
Build commit: 8dd6c97 (8dd6c970aade6a83f0d68d1c80913bde8aa79b32, parent: 3c9faa0d037b9eecda4a440cc482ff7f960fb8a5)

@rust-timer

This comment has been minimized.

@scottmcm scottmcm force-pushed the box_new_uninit_layout branch from f6af841 to d413781 Compare February 17, 2026 03:27
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8dd6c97): 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.7% [0.4%, 1.0%] 3
Regressions ❌
(secondary)
0.6% [0.6%, 0.6%] 2
Improvements ✅
(primary)
-0.3% [-0.4%, -0.2%] 2
Improvements ✅
(secondary)
-1.0% [-3.2%, -0.4%] 8
All ❌✅ (primary) 0.3% [-0.4%, 1.0%] 5

Max RSS (memory usage)

Results (primary -2.3%, secondary 3.4%)

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.4% [2.4%, 4.2%] 5
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-3.2%, -3.2%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.2%, secondary -2.0%)

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

mean range count
Regressions ❌
(primary)
0.3% [0.3%, 0.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.5%, -0.0%] 19
Improvements ✅
(secondary)
-2.0% [-4.2%, -0.7%] 15
All ❌✅ (primary) -0.2% [-0.5%, 0.3%] 20

Bootstrap: 480.798s -> 483.051s (0.47%)
Artifact size: 395.81 MiB -> 395.83 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 Feb 17, 2026
@rust-log-analyzer

This comment has been minimized.

@scottmcm scottmcm force-pushed the box_new_uninit_layout branch 2 times, most recently from 035fa58 to 9ed30a0 Compare February 17, 2026 08:31
@scottmcm
Copy link
Member Author

@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 Feb 17, 2026
Just pass `Layout` directly to `box_new_uninit`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 17, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

☀️ Try build successful (CI)
Build commit: b517e4f (b517e4fd131ad3e507891d12ba6980349893b354, parent: d1a11b670b617f1370f7b1cdf86e225a4e070f15)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b517e4f): 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.8% [0.8%, 0.8%] 1
Regressions ❌
(secondary)
0.8% [0.6%, 0.9%] 5
Improvements ✅
(primary)
-0.7% [-1.2%, -0.3%] 13
Improvements ✅
(secondary)
-1.8% [-4.1%, -0.8%] 11
All ❌✅ (primary) -0.6% [-1.2%, 0.8%] 14

Max RSS (memory usage)

Results (primary 1.3%, secondary 2.1%)

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

mean range count
Regressions ❌
(primary)
4.1% [2.8%, 8.5%] 5
Regressions ❌
(secondary)
3.4% [1.3%, 5.7%] 13
Improvements ✅
(primary)
-3.4% [-3.5%, -3.2%] 3
Improvements ✅
(secondary)
-3.8% [-4.1%, -3.4%] 3
All ❌✅ (primary) 1.3% [-3.5%, 8.5%] 8

Cycles

Results (primary 2.3%, secondary -3.5%)

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

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

Binary size

Results (primary -0.6%, secondary -2.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)
-0.6% [-1.2%, -0.0%] 21
Improvements ✅
(secondary)
-2.1% [-3.6%, -0.1%] 18
All ❌✅ (primary) -0.6% [-1.2%, -0.0%] 21

Bootstrap: 483.207s -> 482.56s (-0.13%)
Artifact size: 397.79 MiB -> 397.80 MiB (0.00%)

We have a constant for it already (used in `RawVec` for basically the same polymorphization) so let's use it.

Conveniently, it can even be safe that way!
@scottmcm scottmcm force-pushed the box_new_uninit_layout branch from 9ed30a0 to 4b03b97 Compare February 17, 2026 17:10
@scottmcm
Copy link
Member Author

@bors r=RalfJung

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

📌 Commit 4b03b97 has been approved by RalfJung

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 17, 2026
@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
Just pass `Layout` directly to `box_new_uninit`

We have a constant for it already (used in `RawVec` for basically the same polymorphization) so let's use it.

This is a simple follow-up to #148190 from one of the comments.
@rust-bors rust-bors bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 22, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

💔 Test for c39eac6 failed: CI. Failed job:

@scottmcm
Copy link
Member Author

@bors retry (Could not resolve host: static.crates.io)

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2026
@rust-log-analyzer
Copy link
Collaborator

The job dist-aarch64-apple failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
/dev/disk1s2     500Mi    20Ki   495Mi     1%       0  5.1M    0%   /System/Volumes/xarts
/dev/disk1s1     500Mi   116Ki   495Mi     1%      25  5.1M    0%   /System/Volumes/iSCPreboot
/dev/disk1s3     500Mi   224Ki   495Mi     1%      18  5.1M    0%   /System/Volumes/Hardware
/dev/disk3s5     320Gi   256Gi    46Gi    85%    2.2M  477M    0%   /System/Volumes/Data
/dev/disk5s1     4.0Mi   676Ki   3.0Mi    19%      18   31k    0%   /System/Library/AssetsV2/com_apple_MobileAsset_PKITrustStore/purpose_auto/6dd55b0d06633a00de6f57ccb910a66a5ba2409a.asset/.AssetData
map auto_home      0Bi     0Bi     0Bi   100%       0     0     -   /System/Volumes/Data/home
##[group]Run src/ci/scripts/setup-environment.sh
src/ci/scripts/setup-environment.sh
shell: /bin/bash --noprofile --norc -e -o pipefail {0}
---
##[endgroup]
==> Fetching downloads for: tidy-html5
✔︎ Bottle Manifest tidy-html5 (5.8.0)
✔︎ Bottle tidy-html5 (5.8.0)
==> Pouring tidy-html5--5.8.0.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/tidy-html5/5.8.0: 15 files, 3.2MB
##[group]Run src/ci/scripts/install-wix.sh
src/ci/scripts/install-wix.sh
shell: /bin/bash --noprofile --norc -e -o pipefail {0}
---
hw.optional.arm.SME_I16I32: 0
hw.optional.arm.FEAT_SME_F64F64: 0
hw.optional.arm.FEAT_SME_I16I64: 0
hw.optional.arm.FP_SyncExceptions: 1
hw.optional.arm.caps: 292171059125284863
hw.optional.arm.sme_max_svl_b: 0
hw.optional.floatingpoint: 1
hw.optional.neon: 1
hw.optional.neon_hpfp: 1
hw.optional.neon_fp16: 1
hw.optional.armv8_crc32: 1
---
/dev/disk1s2     500Mi    20Ki   495Mi     1%       0  5.1M    0%   /System/Volumes/xarts
/dev/disk1s1     500Mi   116Ki   495Mi     1%      25  5.1M    0%   /System/Volumes/iSCPreboot
/dev/disk1s3     500Mi   224Ki   495Mi     1%      18  5.1M    0%   /System/Volumes/Hardware
/dev/disk3s5     320Gi   262Gi    39Gi    87%    2.6M  412M    1%   /System/Volumes/Data
/dev/disk5s1     4.0Mi   676Ki   3.0Mi    19%      18   31k    0%   /System/Library/AssetsV2/com_apple_MobileAsset_PKITrustStore/purpose_auto/6dd55b0d06633a00de6f57ccb910a66a5ba2409a.asset/.AssetData
map auto_home      0Bi     0Bi     0Bi   100%       0     0     -   /System/Volumes/Data/home
Post job cleanup.
[command]/opt/homebrew/bin/git version
git version 2.53.0
Copying '/Users/runner/.gitconfig' to '/Users/runner/work/_temp/353fb001-1286-4413-be62-d1e411de7ee7/.gitconfig'

@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 22, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 22, 2026

☀️ Test successful - CI
Approved by: RalfJung
Duration: 4h 32m 53s
Pushing d8b2222 to main...

@rust-bors rust-bors bot merged commit d8b2222 into rust-lang:main Feb 22, 2026
12 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 22, 2026
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 5fb2ff8 (parent) -> d8b2222 (this PR)

Test differences

Show 222 test diffs

222 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard d8b2222b11fc03a31d43707c8c9006f025809ece --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. aarch64-apple: 3h 4m -> 4h 25m (+44.1%)
  2. i686-gnu-2: 1h 28m -> 1h 59m (+35.4%)
  3. dist-apple-various: 1h 57m -> 1h 27m (-25.7%)
  4. pr-check-1: 27m 18s -> 33m 10s (+21.5%)
  5. i686-msvc-1: 2h 59m -> 3h 33m (+18.9%)
  6. dist-aarch64-llvm-mingw: 1h 38m -> 1h 55m (+17.2%)
  7. x86_64-rust-for-linux: 44m 46s -> 51m 49s (+15.7%)
  8. x86_64-gnu-miri: 1h 10m -> 1h 21m (+15.5%)
  9. x86_64-gnu-tools: 55m 44s -> 1h 3m (+14.6%)
  10. aarch64-gnu-llvm-20-2: 45m 14s -> 51m 24s (+13.6%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d8b2222): comparison URL.

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

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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)
1.3% [1.3%, 1.3%] 1
Regressions ❌
(secondary)
0.7% [0.5%, 0.8%] 6
Improvements ✅
(primary)
-0.8% [-1.1%, -0.5%] 7
Improvements ✅
(secondary)
-1.8% [-3.8%, -0.4%] 9
All ❌✅ (primary) -0.5% [-1.1%, 1.3%] 8

Max RSS (memory usage)

Results (primary -0.4%, secondary 0.4%)

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

mean range count
Regressions ❌
(primary)
5.5% [3.8%, 7.2%] 2
Regressions ❌
(secondary)
3.3% [2.6%, 4.1%] 5
Improvements ✅
(primary)
-2.8% [-4.5%, -1.9%] 5
Improvements ✅
(secondary)
-3.3% [-5.6%, -1.8%] 4
All ❌✅ (primary) -0.4% [-4.5%, 7.2%] 7

Cycles

Results (secondary -2.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)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.6% [-3.7%, -3.4%] 3
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.7%, secondary -2.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)
-0.7% [-1.5%, -0.0%] 27
Improvements ✅
(secondary)
-2.1% [-3.7%, -0.1%] 18
All ❌✅ (primary) -0.7% [-1.5%, -0.0%] 27

Bootstrap: 480.585s -> 481.835s (0.26%)
Artifact size: 395.91 MiB -> 397.84 MiB (0.49%)

@scottmcm scottmcm deleted the box_new_uninit_layout branch February 22, 2026 21:58
@scottmcm
Copy link
Member Author

scottmcm commented Feb 22, 2026

Clearly more green than red overall.

The one primary regression in icounts (1.27%) looks like it's probably just codegen unit shuffling:
image
That case, while red in cycles and wall time, didn't reach the significance threshold for either.

So overall don't think there's anything needed here. The monomorphization structure changing is unsurprising to not be a pure win, but I think it's clearly an overall improvement. The binary size changes are particularly interesting: purely green, with even some opt-profile size improvements, not just debug ones.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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.

6 participants