Skip to content
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

Resolve tweaks #132761

Merged
merged 9 commits into from
Nov 19, 2024
Merged

Resolve tweaks #132761

merged 9 commits into from
Nov 19, 2024

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Nov 8, 2024

A couple of small perf improvements, and some minor refactorings, all in rustc_resolve.

r? @petrochenkov

@rustbot

This comment was marked as outdated.

@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 Nov 8, 2024
@rustbot

This comment was marked as off-topic.

@nnethercote
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 Nov 8, 2024
@bors
Copy link
Contributor

bors commented Nov 8, 2024

⌛ Trying commit 8e22596 with merge 4e79a44...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 8, 2024
@bors
Copy link
Contributor

bors commented Nov 8, 2024

☀️ Try build successful - checks-actions
Build commit: 4e79a44 (4e79a44c027ccc8debd841461a54f63cac112dfb)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4e79a44): 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.3% [-0.5%, -0.1%] 40
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-0.5%, -0.1%] 40

Max RSS (memory usage)

Results (primary 1.3%)

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)
3.3% [1.0%, 5.6%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.8%, -0.7%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [-0.8%, 5.6%] 4

Cycles

Results (secondary 7.9%)

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

Binary size

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

Bootstrap: 780.076s -> 781.343s (0.16%)
Artifact size: 335.37 MiB -> 335.36 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 8, 2024
@petrochenkov petrochenkov self-assigned this Nov 9, 2024
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 9, 2024
`to_lowercase` allocates, but `eq_ignore_ascii_case` doesn't. This path
is hot enough that this makes a small but noticeable difference in
benchmarking.
This gives a small but noticeable performance improvement.
@rustbot

This comment was marked as outdated.

@rustbot

This comment was marked as outdated.

@nnethercote
Copy link
Contributor Author

@petrochenkov: I was going to request a different reviewer because (a) I know you are busy, and (b) none of these changes involve any resolver-specific expertise. But you can review if you want.

@jieyouxu
Copy link
Member

I can take a look.

r? jieyouxu

@rustbot rustbot assigned jieyouxu and unassigned petrochenkov Nov 13, 2024
@jieyouxu jieyouxu added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 13, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, one tiny nit regarding a bool param for a fn that has multiple params that looks confusing at call-sites. But otherwise, this looks like a nice cleanup!

compiler/rustc_resolve/src/ident.rs Show resolved Hide resolved
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2024
@petrochenkov petrochenkov self-assigned this Nov 13, 2024
@petrochenkov
Copy link
Contributor

But you can review if you want.

Yes, I self assign if I want to review, or at least take a look.

@jieyouxu
Copy link
Member

(My bad I didn't notice it)

@jieyouxu jieyouxu removed their assignment Nov 13, 2024
In this case field access is more concise and easier to read than
destructuring, and it matches how other similar loops are done
elsewhere.
`for_each_child` exists for this exact pattern.
Instead of a string comparison.
`resolve_ident_in_module` is a very thin wrapper around
`resolve_ident_in_module_ext`, and `resolve_ident_in_module_unadjusted`
is a very thin wrapper around `resolve_ident_in_module_unadjusted_ext`.
The wrappers make the call sites slightly more concise, but I don't
think that's worth the extra code and indirection.

This commit removes the two wrappers and removes the `_ext` suffixes
from the inner methods.
This path isn't hot enough for this to affect performance, but there's
no point repeating the same computation multiple times.
It was added in rust-lang#115367 for anonymous ADTs. Those changes were then
reverted in rust-lang#131045, but `empty_disambiguator` was left behind, perhaps
by mistake. It seems to be unnecessary.
@nnethercote
Copy link
Contributor Author

I have updated. I removed one old commit (the one updating the comment on BindingKey::disambiguator) and added two new commits (one adding the Shadowing enum, and one removing Resolver::empty_disambiguator).

@nnethercote
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 18, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 19, 2024

📌 Commit 12747f1 has been approved by petrochenkov

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 Nov 19, 2024
@bors
Copy link
Contributor

bors commented Nov 19, 2024

⌛ Testing commit 12747f1 with merge ee612c4...

@bors
Copy link
Contributor

bors commented Nov 19, 2024

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing ee612c4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 19, 2024
@bors bors merged commit ee612c4 into rust-lang:master Nov 19, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 19, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ee612c4): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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.3% [-0.6%, -0.1%] 68
Improvements ✅
(secondary)
-1.1% [-1.1%, -1.1%] 1
All ❌✅ (primary) -0.3% [-0.6%, -0.1%] 68

Max RSS (memory usage)

Results (primary -0.5%, 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.9%, 0.9%] 1
Regressions ❌
(secondary)
3.0% [3.0%, 3.0%] 1
Improvements ✅
(primary)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-1.9%, 0.9%] 2

Cycles

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

Binary size

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

Bootstrap: 793.886s -> 795.801s (0.24%)
Artifact size: 335.28 MiB -> 335.27 MiB (-0.00%)

@nnethercote nnethercote deleted the resolve-tweaks branch November 20, 2024 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

7 participants