Skip to content

Match on lang item kind instead of using an if/else chain #140386

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Apr 28, 2025

Similar to how the new solver does this. Just noticed while I was adding a new entry to the chain 😆

@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 28, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 28, 2025

@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 Apr 28, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2025
…try>

Match on lang item kind instead of using an if/else chain

r? `@ghost`
@bors
Copy link
Collaborator

bors commented Apr 28, 2025

⌛ Trying commit 7454d4c with merge 4ef08a1...

@bors
Copy link
Collaborator

bors commented Apr 28, 2025

☀️ Try build successful - checks-actions
Build commit: 4ef08a1 (4ef08a1befdf4932d9a8347d7a318b04930aa148)

@rust-timer

This comment has been minimized.

@Kobzol
Copy link
Contributor

Kobzol commented Apr 28, 2025

Could also make sense to order these by frequency of occurrence, although PGO might already do that.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4ef08a1): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.8%, -0.2%] 38
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.8%, -0.2%] 38

Max RSS (memory usage)

Results (primary 0.9%, secondary 3.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.9% [0.4%, 3.1%] 16
Regressions ❌
(secondary)
3.0% [2.8%, 3.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.4%, 3.1%] 16

Cycles

Results (primary -0.6%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.7%, -0.5%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.6% [-0.7%, -0.5%] 3

Binary size

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

Bootstrap: 761.588s -> 762.112s (0.07%)
Artifact size: 365.21 MiB -> 365.01 MiB (-0.05%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 28, 2025
@oli-obk
Copy link
Contributor Author

oli-obk commented Apr 28, 2025

@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 Apr 28, 2025
@bors
Copy link
Collaborator

bors commented Apr 28, 2025

⌛ Trying commit 7d3e707 with merge 2658a39b26bea05b2383c33dce1cbcd22491e4cf...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2025
…try>

Match on lang item kind instead of using an if/else chain

r? `@ghost`
@oli-obk oli-obk marked this pull request as ready for review April 28, 2025 13:40
self.assemble_builtin_bound_candidates(clone_conditions, &mut candidates);
let lang_item = tcx.as_lang_item(def_id);
match lang_item {
Some(LangItem::Copy) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge this Copy with the Clone branch below. The behavior should be the same.

);
}
_ => {
match lang_item {
Copy link
Member

@compiler-errors compiler-errors Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a note that we re-match here to deal with the fallthrough case of assembling impl candidates for these user-implementable builtin traits.

@compiler-errors compiler-errors self-assigned this Apr 28, 2025
@bors
Copy link
Collaborator

bors commented Apr 28, 2025

☀️ Try build successful - checks-actions
Build commit: 2658a39 (2658a39b26bea05b2383c33dce1cbcd22491e4cf)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2658a39): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
2.9% [2.9%, 2.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.8%, -0.2%] 36
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-0.8%, 2.9%] 37

Max RSS (memory usage)

Results (primary 0.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.5%, 0.9%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-0.6%, 0.9%] 4

Cycles

Results (primary 0.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.8% [0.5%, 3.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.7%, -0.5%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-0.7%, 3.1%] 7

Binary size

Results (primary 1.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.1% [1.1%, 1.1%] 1

Bootstrap: 761.378s -> 762.587s (0.16%)
Artifact size: 365.18 MiB -> 365.02 MiB (-0.04%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 28, 2025
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