Skip to content

[perf] Fast path for coercions #142701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

compiler-errors
Copy link
Member

Check if the goal holds before trying to walk through the goal. If it certainly holds (or certainly does not), then don't select anything.

@compiler-errors
Copy link
Member Author

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jun 19, 2025
[perf] Fast path for coercions

Check if the goal holds before trying to walk through the goal. If it certainly holds (or certainly does not), then don't select anything.
@rust-bors
Copy link

rust-bors bot commented Jun 19, 2025

⌛ Trying commit 41aaf68 with merge 840dfe0

To cancel the try build, run the command @bors2 try cancel.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 19, 2025
@rust-bors
Copy link

rust-bors bot commented Jun 19, 2025

☀️ Try build successful (CI)
Build commit: 840dfe0 (840dfe0e6a8015d92e12916e9eaa11641c1909cf, parent: d1d8e386c5e84c4ba857f56c3291f73c27e2d62a)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (840dfe0): 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.4% [0.2%, 0.7%] 17
Regressions ❌
(secondary)
1.5% [0.2%, 6.3%] 46
Improvements ✅
(primary)
-0.8% [-2.7%, -0.2%] 32
Improvements ✅
(secondary)
-1.4% [-4.0%, -0.2%] 41
All ❌✅ (primary) -0.4% [-2.7%, 0.7%] 49

Max RSS (memory usage)

Results (primary 0.7%, secondary -1.1%)

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

mean range count
Regressions ❌
(primary)
2.2% [1.2%, 3.6%] 7
Regressions ❌
(secondary)
3.1% [1.0%, 6.0%] 6
Improvements ✅
(primary)
-1.3% [-1.9%, -0.7%] 5
Improvements ✅
(secondary)
-3.5% [-6.8%, -1.1%] 11
All ❌✅ (primary) 0.7% [-1.9%, 3.6%] 12

Cycles

Results (primary -3.0%, secondary -1.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)
3.5% [1.2%, 5.1%] 10
Improvements ✅
(primary)
-3.0% [-3.9%, -1.2%] 7
Improvements ✅
(secondary)
-3.3% [-5.1%, -1.2%] 29
All ❌✅ (primary) -3.0% [-3.9%, -1.2%] 7

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 692.944s -> 692.949s (0.00%)
Artifact size: 372.01 MiB -> 372.04 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 Jun 19, 2025
@compiler-errors
Copy link
Member Author

compiler-errors commented Jun 19, 2025

Ok so this is an improvement at least in the new trait solver, but only ~3%. I'll probably table this for now, because it also requires us to dramatically overhaul how we do diagnostics.

@compiler-errors
Copy link
Member Author

Actually, what if we only check if the goal holds certainly... 🤔

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 19, 2025
@compiler-errors
Copy link
Member Author

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jun 19, 2025

⌛ Trying commit 92b2f28 with merge f8500ef

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 19, 2025
[perf] Fast path for coercions

Check if the goal holds before trying to walk through the goal. If it certainly holds (or certainly does not), then don't select anything.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 19, 2025
@rust-bors
Copy link

rust-bors bot commented Jun 19, 2025

☀️ Try build successful (CI)
Build commit: f8500ef (f8500efe4e5b6b71fbc809554e79843db41613cc, parent: 8de4c7234dd9b97c9d76b58671343fdbbc9a433e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f8500ef): comparison URL.

Overall result: ❌ regressions - 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.7% [0.2%, 1.9%] 106
Regressions ❌
(secondary)
2.2% [0.1%, 9.0%] 112
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 2
Improvements ✅
(secondary)
-0.9% [-1.1%, -0.8%] 3
All ❌✅ (primary) 0.6% [-0.2%, 1.9%] 108

Max RSS (memory usage)

Results (primary 1.6%, secondary -1.8%)

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

mean range count
Regressions ❌
(primary)
1.9% [0.6%, 3.1%] 11
Regressions ❌
(secondary)
2.4% [1.3%, 3.5%] 5
Improvements ✅
(primary)
-1.5% [-1.5%, -1.5%] 1
Improvements ✅
(secondary)
-4.4% [-8.4%, -1.1%] 8
All ❌✅ (primary) 1.6% [-1.5%, 3.1%] 12

Cycles

Results (primary 1.5%, 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)
1.5% [1.0%, 2.6%] 24
Regressions ❌
(secondary)
4.6% [1.8%, 7.4%] 28
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.5% [1.0%, 2.6%] 24

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 691.904s -> 694.234s (0.34%)
Artifact size: 372.02 MiB -> 371.52 MiB (-0.14%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 19, 2025
@compiler-errors compiler-errors deleted the coerce-fast branch June 19, 2025 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants