Skip to content

Conversation

@cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Jun 22, 2025

Profiling JumpThreading reveals that a large part of the runtime happens constructing the place and value Map. This is unfortunate, as jump-threading may end up not even doing anything.

The cause for this large up-front cost is following: Map attempts to create a PlaceIndex for each place that may hold a relevant value. This means all places that appear in MIR, but also all places whose value is accessed by a projection of a copy of a larger place.

This PR refactors the creation of Map to happen on-demand: place and value indices are created when threading computation happens.

The up-front mode is still relevant for DataflowConstProp, so is not touched.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 22, 2025
@cjgillot
Copy link
Contributor 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 Jun 22, 2025
bors added a commit that referenced this pull request Jun 22, 2025
JumpThreading: compute place and value indices on-demand

Perf experiment

r? `@ghost`
@bors
Copy link
Collaborator

bors commented Jun 22, 2025

⌛ Trying commit ba3a8c5 with merge 1587bef...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 22, 2025

☀️ Try build successful - checks-actions
Build commit: 1587bef (1587bef3b2c2aea88de9b552efbf7febe7cd5fc4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1587bef): 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)
1.0% [0.7%, 1.3%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-1.4%, -0.1%] 142
Improvements ✅
(secondary)
-0.4% [-1.7%, -0.1%] 93
All ❌✅ (primary) -0.3% [-1.4%, 1.3%] 144

Max RSS (memory usage)

Results (primary 3.6%, 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)
3.6% [3.4%, 3.8%] 2
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.6% [3.4%, 3.8%] 2

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.2% [0.0%, 0.4%] 12
Regressions ❌
(secondary)
0.2% [0.0%, 0.4%] 42
Improvements ✅
(primary)
-0.3% [-1.4%, -0.0%] 20
Improvements ✅
(secondary)
-0.3% [-0.9%, -0.0%] 5
All ❌✅ (primary) -0.1% [-1.4%, 0.4%] 32

Bootstrap: 689.082s -> 684.233s (-0.70%)
Artifact size: 371.89 MiB -> 372.00 MiB (0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 23, 2025
@rust-log-analyzer

This comment has been minimized.

@cjgillot cjgillot marked this pull request as ready for review June 23, 2025 09:47
@rustbot
Copy link
Collaborator

rustbot commented Jun 23, 2025

r? @eholk

rustbot has assigned @eholk.
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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 23, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cjgillot cjgillot added the A-mir-opt Area: MIR optimizations label Jun 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 23, 2025

Some changes occurred in coverage tests.

cc @Zalathar

@cjgillot
Copy link
Contributor Author

r? compiler

@rustbot rustbot assigned oli-obk and unassigned eholk Jul 20, 2025
@cjgillot cjgillot force-pushed the minimap branch 2 times, most recently from d08b44c to f2018e5 Compare July 26, 2025 01:22
@bors
Copy link
Collaborator

bors commented Jul 28, 2025

☔ The latest upstream changes (presumably #144469) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Dec 2, 2025

☔ The latest upstream changes (presumably #142821) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Dec 14, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@cjgillot
Copy link
Contributor Author

@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 Dec 14, 2025
JumpThreading: compute place and value indices on-demand
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 14, 2025
@rust-bors
Copy link

rust-bors bot commented Dec 14, 2025

☀️ Try build successful (CI)
Build commit: 27d3ab5 (27d3ab51bc0ae9029d0c94e6a28b4dd891d93f7c, parent: 0208ee09be465f69005a7a12c28d5eccac7d5f34)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (27d3ab5): 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.2%, 1.5%] 5
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.4% [-1.3%, -0.1%] 109
Improvements ✅
(secondary)
-0.5% [-1.9%, -0.1%] 84
All ❌✅ (primary) -0.4% [-1.3%, 1.5%] 114

Max RSS (memory usage)

Results (primary 0.5%, secondary -2.2%)

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

mean range count
Regressions ❌
(primary)
4.0% [2.0%, 7.0%] 3
Regressions ❌
(secondary)
0.8% [0.8%, 0.8%] 1
Improvements ✅
(primary)
-2.9% [-3.3%, -2.6%] 3
Improvements ✅
(secondary)
-3.7% [-4.2%, -3.3%] 2
All ❌✅ (primary) 0.5% [-3.3%, 7.0%] 6

Cycles

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

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)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
-4.6% [-4.6%, -4.6%] 1
All ❌✅ (primary) -1.9% [-1.9%, -1.9%] 1

Binary size

Results (primary -0.2%, 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)
0.2% [0.1%, 0.3%] 6
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 7
Improvements ✅
(primary)
-0.4% [-1.4%, -0.0%] 16
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.1%] 4
All ❌✅ (primary) -0.2% [-1.4%, 0.3%] 22

Bootstrap: 479.155s -> 476.389s (-0.58%)
Artifact size: 390.26 MiB -> 390.47 MiB (0.05%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 15, 2025
@saethlin
Copy link
Member

The perf results are quite compelling. Well done!

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 27, 2025

📌 Commit 9415102 has been approved by saethlin

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 Dec 27, 2025
@bors
Copy link
Collaborator

bors commented Dec 27, 2025

⌛ Testing commit 9415102 with merge c7aa99f...

@bors
Copy link
Collaborator

bors commented Dec 27, 2025

☀️ Test successful - checks-actions
Approved by: saethlin
Pushing c7aa99f to main...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 27, 2025
@bors bors merged commit c7aa99f into rust-lang:main Dec 27, 2025
13 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 27, 2025
@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 38ed770 (parent) -> c7aa99f (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 c7aa99f36ccad2c127edec5be493cab0b152f436 --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. dist-aarch64-msvc: 6942.8s -> 5824.8s (-16.1%)
  2. aarch64-gnu-debug: 4560.5s -> 3869.7s (-15.1%)
  3. pr-check-1: 1934.8s -> 1667.7s (-13.8%)
  4. tidy: 173.8s -> 150.9s (-13.2%)
  5. aarch64-msvc-1: 7397.6s -> 6532.5s (-11.7%)
  6. x86_64-gnu-tools: 3718.4s -> 3315.7s (-10.8%)
  7. i686-gnu-2: 6032.1s -> 5441.3s (-9.8%)
  8. x86_64-rust-for-linux: 3217.4s -> 2913.3s (-9.5%)
  9. aarch64-gnu-llvm-20-2: 3267.6s -> 2960.9s (-9.4%)
  10. dist-apple-various: 4350.7s -> 3957.2s (-9.0%)
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 (c7aa99f): 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.4% [1.4%, 1.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.4%, -0.2%] 117
Improvements ✅
(secondary)
-0.5% [-1.9%, -0.1%] 93
All ❌✅ (primary) -0.4% [-1.4%, 1.4%] 118

Max RSS (memory usage)

Results (primary -1.0%, secondary -3.8%)

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

mean range count
Regressions ❌
(primary)
1.8% [1.2%, 2.7%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.9% [-7.8%, -1.4%] 3
Improvements ✅
(secondary)
-3.8% [-3.8%, -3.8%] 1
All ❌✅ (primary) -1.0% [-7.8%, 2.7%] 6

Cycles

Results (secondary 4.7%)

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)
4.7% [4.7%, 4.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

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

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.3%, -0.0%] 12
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 4
All ❌✅ (primary) -0.3% [-1.3%, 1.1%] 13

Bootstrap: 486.937s -> 480.868s (-1.25%)
Artifact size: 392.46 MiB -> 390.80 MiB (-0.42%)

@lqd
Copy link
Member

lqd commented Dec 27, 2025

Improvements in icounts heavily outweigh the one regression (which is also a proc-macro in an opt scenario: not a default cargo config)

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 27, 2025
@cjgillot cjgillot deleted the minimap branch December 27, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-mir-opt Area: MIR optimizations merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.