Skip to content

Conversation

@petrochenkov
Copy link
Contributor

It allows to avoid expensive double normalization in some cases.
This is an attempt to fix the perf regressions from #149681.

@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 Jan 6, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 6, 2026

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jan 6, 2026
resolve: Use `Macros20NormalizedIdent` in more interfaces
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 6, 2026
@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2026
@rust-bors

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 7, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 7, 2026

☀️ Try build successful (CI)
Build commit: e520b01 (e520b01b98bd6455f6d47eded6e6c5b14be22ce7, parent: 4d73a008eaf6ba3ca067a3221e5c00602e33a5f2)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e520b01): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.6%, -0.1%] 120
Improvements ✅
(secondary)
-0.4% [-1.1%, -0.1%] 55
All ❌✅ (primary) -0.3% [-0.6%, -0.1%] 120

Max RSS (memory usage)

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

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: 473.709s -> 471.656s (-0.43%)
Artifact size: 390.82 MiB -> 390.89 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 7, 2026
@petrochenkov
Copy link
Contributor Author

How often resolve_ident_in_scope_set is used with different scope sets:

Module:        1015781
All:            445512
Macro:          217256
ExternPrelude:     649

So, ScopeSet::Module is the new dominating mode of use for resolve_ident_in_scope_set, it's not surprising that it's stressing it.

It allows to avoid expensive double normalization in some cases
In practice it was already normalized because `visit_scopes` normalized it
Also evaluate one cheap and often-false condition first
@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 7, 2026
rust-bors bot added a commit that referenced this pull request Jan 7, 2026
resolve: Use `Macros20NormalizedIdent` in more interfaces
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 7, 2026

☀️ Try build successful (CI)
Build commit: d6b68ca (d6b68ca4b912a0e27bcdf1f604470687653b8d16, parent: d9617c8d9a55773a96b61ba3a4acb107d65615c1)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d6b68ca): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
-0.3% [-0.6%, -0.1%] 116
Improvements ✅
(secondary)
-0.4% [-1.2%, -0.1%] 53
All ❌✅ (primary) -0.3% [-0.6%, -0.1%] 116

Max RSS (memory usage)

Results (primary -1.2%, secondary 0.8%)

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.8% [0.8%, 0.8%] 3
Improvements ✅
(primary)
-1.2% [-2.0%, -0.5%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.2% [-2.0%, -0.5%] 4

Cycles

Results (primary 3.0%, secondary 1.5%)

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

mean range count
Regressions ❌
(primary)
3.0% [2.1%, 3.9%] 2
Regressions ❌
(secondary)
2.4% [1.3%, 3.5%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) 3.0% [2.1%, 3.9%] 2

Binary size

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

Bootstrap: 474.542s -> 478.609s (0.86%)
Artifact size: 390.84 MiB -> 390.88 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 7, 2026
@petrochenkov
Copy link
Contributor Author

The large-workspace regression is spurious (llvm codegen time regresses, which is unrelated to this PR).

@petrochenkov
Copy link
Contributor Author

This recovers roughly a half of performance lost in #149681.
I have a couple more ideas about speeding up resolve_ident_in_scope_set, but I'm less sure in them and would rather benchmark them separately.

@rustbot ready
r? @nnethercote maybe?

@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 Jan 7, 2026
@rustbot rustbot assigned nnethercote and unassigned SparrowLii Jan 7, 2026
@nnethercote
Copy link
Contributor

@bors r+

@rust-bors rust-bors bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 8, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 8, 2026

📌 Commit 99a7d28 has been approved by nnethercote

It is now in the queue for this repository.

@rust-bors rust-bors bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

6 participants