Skip to content

Only load the feature list once in the entire resolver#158263

Open
oli-obk wants to merge 1 commit into
rust-lang:mainfrom
oli-obk:feature-once
Open

Only load the feature list once in the entire resolver#158263
oli-obk wants to merge 1 commit into
rust-lang:mainfrom
oli-obk:feature-once

Conversation

@oli-obk

@oli-obk oli-obk commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

I saw that a bunch of code in ast validation and other early logic just had the features query called once and stored the result. Let's see what the resolver does with that.

@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 Jun 22, 2026
@oli-obk

oli-obk commented Jun 22, 2026

Copy link
Copy Markdown
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 Jun 22, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
Only load the feature list once in the entire resolver
@petrochenkov petrochenkov self-assigned this Jun 22, 2026
@rust-bors

rust-bors Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 4063797 (4063797428d2889154a1f321d903212b4a5c8b32)
Base parent: cddcbec (cddcbec198760511240bf0e728193bf4d700acb4)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (4063797): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary -3.0%, secondary 0.4%)

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.5% [2.1%, 2.9%] 2
Improvements ✅
(primary)
-3.0% [-3.2%, -2.7%] 2
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 2
All ❌✅ (primary) -3.0% [-3.2%, -2.7%] 2

Cycles

Results (primary -1.6%, secondary -1.2%)

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.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
-1.6% [-1.9%, -1.4%] 2
Improvements ✅
(secondary)
-5.2% [-5.2%, -5.2%] 1
All ❌✅ (primary) -1.6% [-1.9%, -1.4%] 2

Binary size

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

Bootstrap: 505.379s -> 504.697s (-0.13%)
Artifact size: 353.06 MiB -> 353.50 MiB (0.12%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 22, 2026
@oli-obk oli-obk marked this pull request as ready for review June 22, 2026 19:56
@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 Jun 22, 2026
Comment thread compiler/rustc_resolve/src/lib.rs Outdated
/// Stores `#[diagnostic::on_unknown]` attributes placed on module declarations.
on_unknown_data: FxHashMap<LocalDefId, OnUnknownData>,
on_unknown_data: FxHashMap<LocalDefId, OnUnknownData> = default::fx_hash_map(),
pub features: &'tcx Features,

@petrochenkov petrochenkov Jun 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub features: &'tcx Features,
features: &'tcx Features,

Nothing else in Resolver is public, rustc_interface can probably survive calling tcx.features() one more time.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea 😅 that was a bit overkill

@petrochenkov

Copy link
Copy Markdown
Contributor

r=me with #158263 (comment) addressed.
@rustbot author

@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 Jun 23, 2026
@rustbot

rustbot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

rustbot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

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.

@rust-log-analyzer

This comment has been minimized.

@oli-obk

oli-obk commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@bors r=petrochenkov rollup

@rust-bors

rust-bors Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit bd73fb8 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 23, 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.

5 participants