Skip to content

Conversation

the8472
Copy link
Member

@the8472 the8472 commented Oct 4, 2025

I saw a bunch of dead, empty <[core::mem::maybe_uninit::MaybeUninit<T>; N] as core::array::iter::iter_inner::PartialDrop>::partial_drop functions when compiling with more than 1 CGU.

Let's see if we can help optimizations to eliminate stuff earlier.

r? ghost

@rustbot rustbot added 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 Oct 4, 2025
@the8472 the8472 force-pushed the nondrop-array-iter branch from 3116ce6 to 7f10971 Compare October 4, 2025 22:34
@the8472
Copy link
Member Author

the8472 commented Oct 4, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 4, 2025
only call polymorphic array iter drop machinery when the type requires it
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 4, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 5, 2025

☀️ Try build successful (CI)
Build commit: 7a5c0c2 (7a5c0c26f80ea669941a7c760c9d0e4ebbfc8a23, parent: 2cb4e7dce84fdebc0279159f1082f92b99299d87)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7a5c0c2): 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.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
0.9% [0.8%, 1.0%] 6
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 2
All ❌✅ (primary) 0.3% [-0.1%, 0.6%] 2

Max RSS (memory usage)

Results (primary 0.7%, 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)
3.0% [0.7%, 5.1%] 4
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-4.0% [-5.6%, -2.4%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [-5.6%, 5.1%] 6

Cycles

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

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.1%] 6
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.2% [-0.5%, -0.0%] 14
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.5%, 0.1%] 20

Bootstrap: 471.593s -> 470.766s (-0.18%)
Artifact size: 388.35 MiB -> 388.32 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 Oct 5, 2025
@the8472 the8472 force-pushed the nondrop-array-iter branch from d418872 to 8e79e6d Compare October 5, 2025 09:02
@the8472
Copy link
Member Author

the8472 commented Oct 5, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 5, 2025
only call polymorphic array iter drop machinery when the type requires it
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 5, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 5, 2025

☀️ Try build successful (CI)
Build commit: 61c5b78 (61c5b789d1ab11492050b0106aac2e724cf4a4d9, parent: e2c96cc06bdbdbc6f59c7551194d6a742260d6ff)

@rust-timer

This comment has been minimized.

@rust-timer

This comment was marked as outdated.

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 5, 2025
@the8472 the8472 force-pushed the nondrop-array-iter branch from 8e79e6d to 7f10971 Compare October 5, 2025 13:18
@the8472 the8472 marked this pull request as ready for review October 5, 2025 13:20
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 5, 2025
@the8472
Copy link
Member Author

the8472 commented Oct 5, 2025

First perf run looks better, going with that one. Binary sizes are down on average, including rustc artifact sizes.
The wg-grammar instruction regression... the history looks like it's just oscillating? So maybe noise.

r? @scottmcm

@scottmcm
Copy link
Member

scottmcm commented Oct 5, 2025

Is there any way we can have a test for the original problem? This feels like the kind of change that a well-meaning person could easily undo later without realizing it.

@the8472
Copy link
Member Author

the8472 commented Oct 5, 2025

On godbolt it only reproduces when linking a lib crate and then disassembling it. Using emit-asm doesn't work because it forces 1CGU. https://rust.godbolt.org/z/78fMrGGxc

I could try writing a run-make test but seems a bit overkill.

@the8472
Copy link
Member Author

the8472 commented Oct 5, 2025

But I can add a comment.

@the8472 the8472 force-pushed the nondrop-array-iter branch from 7f10971 to ff91dbd Compare October 5, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants