Skip to content

Fix visible_parent_map fallback map merging perf regression - #160811

Draft
zalanlevai wants to merge 1 commit into
rust-lang:mainfrom
zalanlevai:160464-perf-regression
Draft

Fix visible_parent_map fallback map merging perf regression#160811
zalanlevai wants to merge 1 commit into
rust-lang:mainfrom
zalanlevai:160464-perf-regression

Conversation

@zalanlevai

@zalanlevai zalanlevai commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

This PR attempts to fix the visible_parent_map perf regression introduced in #160464.

Because the original PR fixes unnecessary iterations in the breadth-first search (BFS), meaning that it only reduces the amount of work during the BFS, the likely cause of the perf regression is the changed merging of the fallback map into the final visible parent map.

The goal of this draft PR is to determine whether this is the case through a perf try run. The change itself works around the Unord* APIs, but might be worth it to work around the perf regression.

  • I did not use an LLM to create a change in this PR.
  • I used an LLM to create a change in this PR, and I have explained below how it was used.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 9, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@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 Aug 9, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 9, 2026
Fix visible_parent_map fallback map merging perf regression
@rust-bors

rust-bors Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 9cbccc7 (9cbccc762cb6f14132feb088e9dd05ce77b54760)
Base parent: 153ecc4 (153ecc4f74035b709bb3e1eb9546f1d934865042)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (9cbccc7): 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 rustc-perf
@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
Regressions ❌
(secondary)
0.4% [0.2%, 0.5%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.4%] 6
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -9.2%, secondary -0.4%)

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.6% [0.5%, 0.8%] 5
Improvements ✅
(primary)
-9.2% [-9.2%, -9.2%] 1
Improvements ✅
(secondary)
-0.8% [-2.4%, -0.4%] 10
All ❌✅ (primary) -9.2% [-9.2%, -9.2%] 1

Cycles

Results (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)
- - 0
Regressions ❌
(secondary)
1.2% [0.4%, 5.0%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-1.6%, -0.4%] 11
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 458.036s -> 460.145s (0.46%)
Artifact size: 398.61 MiB -> 398.66 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 Aug 9, 2026
@zalanlevai

zalanlevai commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@JonathanBrouwer Thanks! I had a look through the perf run results and compared each benchmark that regressed in #160464 with the corresponding benchmark in this perf run. This change resolves all 7 perf regressions introduced in #160464, with the percentage deltas in this perf run cancelling out the ones in the perf run of the regressed PR.

This change's perf run also shows 7 other perf regressions of similar magnitude: 5 are the deep-vector benchmark and the other two are the tuple-stress benchmark. However, looking at their code, these two benchmarks do not contain code that would be affected by this change, at least from what I can tell. Looking at the profiles for these regressed benchmarks, the visible_parent_map query is not significant enough to show up in any of the before or after profiles. Do you think these new regressions could be a fluke or unrelated to this change?

@zalanlevai

Copy link
Copy Markdown
Contributor Author

I believe this is the correct label given the findings in my previous comment.

@rustbot label +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants