Skip to content

perf: Avoid freshening the same predicate twice per selection - #160484

Draft
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:perf/selection-single-freshen
Draft

perf: Avoid freshening the same predicate twice per selection#160484
xmakro wants to merge 1 commit into
rust-lang:mainfrom
xmakro:perf/selection-single-freshen

Conversation

@xmakro

@xmakro xmakro commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

candidate_from_obligation freshens a predicate that push_stack already freshened. The two results can only differ if the predicate contains type or const inference variables. If it has none, we reuse stack.fresh_trait_pred and skip the second freshening.

@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 4, 2026
@Kobzol

Kobzol commented Aug 4, 2026

Copy link
Copy Markdown
Member

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 4, 2026
perf: Avoid freshening the same predicate twice per selection
@rust-bors

rust-bors Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e0160e1 (e0160e1f3fe1659f4d274a0552c202f82c5d2d01)
Base parent: c9ff496 (c9ff496891c278ad660bc0ab85c1f0b72059464a)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (e0160e1): comparison URL.

Overall result: ✅ improvements - 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 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
Improvements ✅
(primary)
-0.3% [-0.4%, -0.2%] 14
Improvements ✅
(secondary)
-1.2% [-3.4%, -0.2%] 22
All ❌✅ (primary) -0.3% [-0.4%, -0.2%] 14

Max RSS (memory usage)

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

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)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-0.6% [-0.7%, -0.4%] 10
All ❌✅ (primary) -0.6% [-0.6%, -0.6%] 1

Cycles

Results (primary -0.0%, secondary 7.2%)

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

mean range count
Regressions ❌
(primary)
1.0% [0.5%, 2.3%] 10
Regressions ❌
(secondary)
8.7% [0.4%, 20.1%] 18
Improvements ✅
(primary)
-3.2% [-6.6%, -0.6%] 3
Improvements ✅
(secondary)
-2.0% [-2.9%, -0.6%] 3
All ❌✅ (primary) -0.0% [-6.6%, 2.3%] 13

Binary size

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

Bootstrap: 489.838s -> 489.173s (-0.14%)
Artifact size: 390.28 MiB -> 390.28 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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