Skip to content

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

Open
ohadravid wants to merge 2 commits intorust-lang:mainfrom
ohadravid:faster-storage-in-copyprop-and-gvn
Open

Fix performance regression introduced in #142531 by excluding Storage{Live,Dead} from CGU size estimation#155491
ohadravid wants to merge 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

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 🙏

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-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