Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the explanation for why we use box_new in vec! #135365

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Jan 11, 2025

The perf run in this PR demonstrates that there is no longer a dramatic change in compile time with the intrinsic box_new vs calling Box::new, but I've locally confirmed that there is still a dramatic change in stack use.

@saethlin saethlin added the S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. label Jan 11, 2025
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 11, 2025
@saethlin
Copy link
Member 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 Jan 11, 2025
@bors
Copy link
Contributor

bors commented Jan 11, 2025

⌛ Trying commit fe921ed with merge a33faef...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2025
Use Box::new instead of the box_new intrinsic in vec! expansion

r? ghost

This should perf differently since rust-lang#135274 landed.

Some UI tests are failing locally and seem to indicate a diagnostic regression that I'll fix if this perfs well.
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 11, 2025

☀️ Try build successful - checks-actions
Build commit: a33faef (a33faef4b3c4e5aefbb4beb8ff61a6dfc115e928)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a33faef): comparison URL.

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

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.5% [0.2%, 0.8%] 2
Regressions ❌
(secondary)
1.5% [1.4%, 1.7%] 12
Improvements ✅
(primary)
-0.5% [-0.5%, -0.5%] 1
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 3
All ❌✅ (primary) 0.2% [-0.5%, 0.8%] 3

Max RSS (memory usage)

Results (primary -0.8%, secondary -2.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.9% [1.5%, 4.0%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.5% [-9.5%, -0.8%] 4
Improvements ✅
(secondary)
-2.7% [-3.2%, -2.1%] 2
All ❌✅ (primary) -0.8% [-9.5%, 4.0%] 8

Cycles

Results (primary -1.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Binary size

Results (primary -0.0%, secondary 0.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.2%] 12
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 6
Improvements ✅
(primary)
-0.1% [-0.4%, -0.0%] 31
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 4
All ❌✅ (primary) -0.0% [-0.4%, 0.2%] 43

Bootstrap: 762.986s -> 761.223s (-0.23%)
Artifact size: 326.03 MiB -> 326.02 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 Jan 11, 2025
@saethlin saethlin removed S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. perf-regression Performance regression. labels Jan 12, 2025
@saethlin saethlin changed the title Use Box::new instead of the box_new intrinsic in vec! expansion Update the explanation for why we use box_new in vec! Jan 12, 2025
@saethlin
Copy link
Member Author

r? libs

@saethlin saethlin marked this pull request as ready for review January 12, 2025 18:19
@compiler-errors
Copy link
Member

this is just a comment so

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 12, 2025

📌 Commit 6024a06 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors 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 Jan 12, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 12, 2025
Update the explanation for why we use box_new in vec!

The perf run in this PR demonstrates that there is no longer a dramatic change in compile time with the intrinsic `box_new` vs calling `Box::new`, but I've locally confirmed that there is still a dramatic change in stack use.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 12, 2025
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#135348 (rustdoc-json: Include items in stripped modules in `Crate::paths`.)
 - rust-lang#135365 (Update the explanation for why we use box_new in vec!)
 - rust-lang#135383 (De-abstract tagged ptr and make it covariant)
 - rust-lang#135401 (Remove some empty expected files to fix blessing)
 - rust-lang#135406 (Update unstable lint docs to include required feature attributes)
 - rust-lang#135407 (Deny various clippy lints)
 - rust-lang#135411 (run_make_support: add `#![warn(unreachable_pub)]`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 24cc0cb into rust-lang:master Jan 13, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 13, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 13, 2025
Rollup merge of rust-lang#135365 - saethlin:box-new, r=compiler-errors

Update the explanation for why we use box_new in vec!

The perf run in this PR demonstrates that there is no longer a dramatic change in compile time with the intrinsic `box_new` vs calling `Box::new`, but I've locally confirmed that there is still a dramatic change in stack use.
@saethlin saethlin deleted the box-new branch January 13, 2025 02:02
@safinaskar
Copy link
Contributor

@rustbot label A-box

@rustbot rustbot added the A-box Area: Our favorite opsem complication label Feb 6, 2025
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request Mar 11, 2025
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#135348 (rustdoc-json: Include items in stripped modules in `Crate::paths`.)
 - rust-lang#135365 (Update the explanation for why we use box_new in vec!)
 - rust-lang#135383 (De-abstract tagged ptr and make it covariant)
 - rust-lang#135401 (Remove some empty expected files to fix blessing)
 - rust-lang#135406 (Update unstable lint docs to include required feature attributes)
 - rust-lang#135407 (Deny various clippy lints)
 - rust-lang#135411 (run_make_support: add `#![warn(unreachable_pub)]`)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-box Area: Our favorite opsem complication S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants