Skip to content

Fix performance regression introduced in #142531 by excluding Storage{Live,Dead} from CGU size estimation#155491

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
ohadravid:faster-storage-in-copyprop-and-gvn
Apr 21, 2026
Merged

Fix performance regression introduced in #142531 by excluding Storage{Live,Dead} from CGU size estimation#155491
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
ohadravid:faster-storage-in-copyprop-and-gvn

Conversation

@ohadravid
Copy link
Copy Markdown
Contributor

@ohadravid ohadravid commented Apr 18, 2026

View all comments

Fix performance regression introduced in #142531 (rust-timer comment) by excluding Storage{Live,Dead} from CGU size estimation.

Also, avoid unneeded work for storage removal in non-opt builds in CopyProp and GVN
by allocating local sets for the storage accounting only when tcx.sess.emit_lifetime_markers().

r? saethlin

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 18, 2026

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 18, 2026
@ohadravid ohadravid force-pushed the faster-storage-in-copyprop-and-gvn branch from 544ea18 to bb8798b Compare April 18, 2026 16:43
for (local, &head) in ssa.copy_classes().iter_enumerated() {
if local != head {
any_replacement = true;
storage_to_remove.insert(head);
Copy link
Copy Markdown
Contributor Author

@ohadravid ohadravid Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ohadravid ohadravid force-pushed the faster-storage-in-copyprop-and-gvn branch from bb8798b to 2389a3a Compare April 18, 2026 19:13
@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented Apr 18, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 18, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 18, 2026
… r=<try>

Avoid unneeded work for storage removal in non-opt builds in CopyProp and GVN
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 18, 2026

☀️ Try build successful (CI)
Build commit: 48af6e0 (48af6e0fab57d8f8b2679fe3401c5b490589dad7, parent: b2f1ccf524a3a4cf9c34545167cc23b659cf1cbd)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (48af6e0): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

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

Instruction count

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

Max RSS (memory usage)

Results (primary 4.2%, secondary -1.5%)

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

mean range count
Regressions ❌
(primary)
4.2% [3.0%, 5.4%] 2
Regressions ❌
(secondary)
1.2% [1.2%, 1.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.2% [-4.2%, -4.2%] 1
All ❌✅ (primary) 4.2% [3.0%, 5.4%] 2

Cycles

Results (primary 2.6%, secondary 6.2%)

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

mean range count
Regressions ❌
(primary)
2.6% [2.6%, 2.6%] 1
Regressions ❌
(secondary)
6.2% [3.8%, 8.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.6% [2.6%, 2.6%] 1

Binary size

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

Bootstrap: 492.524s -> 492.577s (0.01%)
Artifact size: 394.41 MiB -> 394.45 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 18, 2026
@ohadravid
Copy link
Copy Markdown
Contributor Author

(I probably won't be able to do this, right @Kobzol ?)

@bors try @rust-timer queue

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 19, 2026

@ohadravid: 🔑 Insufficient privileges: not in try users

@rust-timer

This comment has been minimized.

@panstromek
Copy link
Copy Markdown
Contributor

@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 Apr 19, 2026
… r=<try>

Avoid unneeded work for storage removal in non-opt builds in CopyProp and GVN
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 19, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 19, 2026

☀️ Try build successful (CI)
Build commit: 9ab524a (9ab524a53632bd338dd70682bc997e2503f70f8a, parent: ec2d669db8e5ca2cb1604c69a831ef244ebd9aa9)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (9ab524a): comparison URL.

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

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

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=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)
2.2% [0.8%, 4.6%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.1% [-14.1%, -0.2%] 9
Improvements ✅
(secondary)
-3.8% [-9.1%, -1.1%] 3
All ❌✅ (primary) -1.9% [-14.1%, 4.6%] 14

Max RSS (memory usage)

Results (primary -1.7%, secondary -1.4%)

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

mean range count
Regressions ❌
(primary)
2.6% [2.1%, 2.9%] 3
Regressions ❌
(secondary)
4.6% [4.6%, 4.6%] 1
Improvements ✅
(primary)
-3.3% [-4.6%, -1.0%] 8
Improvements ✅
(secondary)
-3.3% [-4.3%, -2.4%] 3
All ❌✅ (primary) -1.7% [-4.6%, 2.9%] 11

Cycles

Results (primary -3.4%, secondary -4.5%)

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

mean range count
Regressions ❌
(primary)
3.8% [2.2%, 5.6%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-8.9% [-12.4%, -3.0%] 4
Improvements ✅
(secondary)
-4.5% [-9.8%, -1.6%] 3
All ❌✅ (primary) -3.4% [-12.4%, 5.6%] 7

Binary size

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

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

mean range count
Regressions ❌
(primary)
0.7% [0.2%, 2.0%] 11
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
-0.7% [-1.8%, -0.1%] 19
Improvements ✅
(secondary)
-1.0% [-3.8%, -0.1%] 10
All ❌✅ (primary) -0.2% [-1.8%, 2.0%] 30

Bootstrap: 490.129s -> 492.074s (0.40%)
Artifact size: 394.32 MiB -> 394.29 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Apr 19, 2026
@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 19, 2026
@saethlin
Copy link
Copy Markdown
Member

Can you update the PR description to include the second commit as well? Then r=me. It's up to you if you want to include the initial optimization as well, I think it makes logical sense and doesn't introduce too much complexity so it would be okay to include it. Even though it doesn't seem very impactful.

@ohadravid ohadravid changed the title Avoid unneeded work for storage removal in non-opt builds in CopyProp and GVN Fix performance regression introduced in rust-lang/rust#142531 by excluding Storage{Live,Dead} from CGU size estimation Apr 20, 2026
@ohadravid ohadravid changed the title Fix performance regression introduced in rust-lang/rust#142531 by excluding Storage{Live,Dead} from CGU size estimation Fix performance regression introduced in #142531 by excluding Storage{Live,Dead} from CGU size estimation Apr 20, 2026
@ohadravid
Copy link
Copy Markdown
Contributor Author

@saethlin done 🙏

@saethlin
Copy link
Copy Markdown
Member

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 21, 2026

📌 Commit 846974e has been approved by saethlin

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 Apr 21, 2026
@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 Apr 21, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 21, 2026

☀️ Test successful - CI
Approved by: saethlin
Duration: 3h 23m 16s
Pushing 9ab01ae to main...

@rust-bors rust-bors Bot merged commit 9ab01ae into rust-lang:main Apr 21, 2026
13 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 21, 2026
@github-actions
Copy link
Copy Markdown
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 84c1190 (parent) -> 9ab01ae (this PR)

Test differences

Show 3 test diffs

3 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 9ab01ae53c416f89fe256b79588a76dcbcdc9290 --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. x86_64-msvc-2: 1h 58m -> 2h 38m (+34.2%)
  2. x86_64-gnu-stable: 1h 50m -> 2h 19m (+26.0%)
  3. dist-ohos-aarch64: 1h 3m -> 1h 17m (+21.7%)
  4. aarch64-apple: 2h 42m -> 3h 17m (+21.4%)
  5. dist-apple-various: 1h 25m -> 1h 42m (+20.3%)
  6. dist-powerpc64-linux-musl: 1h 14m -> 1h 28m (+18.3%)
  7. dist-android: 27m 55s -> 23m 11s (-16.9%)
  8. dist-x86_64-apple: 2h -> 2h 19m (+16.2%)
  9. x86_64-rust-for-linux: 55m 2s -> 46m 16s (-15.9%)
  10. pr-check-1: 33m 5s -> 27m 52s (-15.8%)
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
Copy Markdown
Collaborator

Finished benchmarking commit (9ab01ae): comparison URL.

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

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)
2.1% [0.8%, 4.6%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.2% [-14.1%, -0.2%] 9
Improvements ✅
(secondary)
-3.9% [-9.2%, -1.2%] 3
All ❌✅ (primary) -1.9% [-14.1%, 4.6%] 14

Max RSS (memory usage)

Results (primary -1.4%, secondary 0.0%)

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

mean range count
Regressions ❌
(primary)
3.3% [2.4%, 4.8%] 3
Regressions ❌
(secondary)
4.2% [3.6%, 4.7%] 2
Improvements ✅
(primary)
-3.4% [-5.9%, -0.9%] 7
Improvements ✅
(secondary)
-2.8% [-3.9%, -1.1%] 3
All ❌✅ (primary) -1.4% [-5.9%, 4.8%] 10

Cycles

Results (primary -4.6%, secondary -4.1%)

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

mean range count
Regressions ❌
(primary)
4.4% [3.5%, 5.4%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-9.0% [-13.0%, -3.5%] 4
Improvements ✅
(secondary)
-4.1% [-9.2%, -2.2%] 9
All ❌✅ (primary) -4.6% [-13.0%, 5.4%] 6

Binary size

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

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

mean range count
Regressions ❌
(primary)
0.6% [0.1%, 2.0%] 14
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
-0.7% [-2.2%, -0.1%] 22
Improvements ✅
(secondary)
-0.8% [-3.8%, -0.1%] 14
All ❌✅ (primary) -0.2% [-2.2%, 2.0%] 36

Bootstrap: 490.276s -> 490.352s (0.02%)
Artifact size: 394.36 MiB -> 394.40 MiB (0.01%)

@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented Apr 21, 2026

Fixed a previous regression from #142531.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Apr 21, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants