Skip to content

Resolver: Wrap arenas in WorkerLocal#159019

Open
LorrensP-2158466 wants to merge 1 commit into
rust-lang:mainfrom
LorrensP-2158466:worker-local-arenas
Open

Resolver: Wrap arenas in WorkerLocal#159019
LorrensP-2158466 wants to merge 1 commit into
rust-lang:mainfrom
LorrensP-2158466:worker-local-arenas

Conversation

@LorrensP-2158466

@LorrensP-2158466 LorrensP-2158466 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

In preperation of parallel import resolution #158845 this pr wraps the resolver arenas in WorkerLocal to ensure we don't need any synchronization to access an arena. This is common in the compiler.

Also, when building the resolution table of an external module, we first create a seperate table and fill that one, after which we replace the empty table with that new table. (Prep Work for #158845)
And a manual inline of define_extern.

r? @petrochenkov

@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 Jul 9, 2026
@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_resolve/src/build_reduced_graph.rs Outdated
Comment thread compiler/rustc_resolve/src/build_reduced_graph.rs Outdated
Comment thread compiler/rustc_resolve/src/build_reduced_graph.rs Outdated
Comment thread compiler/rustc_resolve/src/build_reduced_graph.rs Outdated
@petrochenkov

Copy link
Copy Markdown
Contributor

@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 Jul 9, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 9, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

The PR description needs an update, it's not only about arenas.
@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 Jul 9, 2026
@rustbot

rustbot commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

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

@rust-bors

rust-bors Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 8921b29 (8921b29e422cc22127146a787dda0186d080d041)
Base parent: 561ea2b (561ea2bfa3022226082e2db39d6ccb241e9e34bc)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (8921b29): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@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.3% [0.3%, 0.3%] 2
Regressions ❌
(secondary)
0.3% [0.1%, 0.6%] 16
Improvements ✅
(primary)
-0.4% [-0.5%, -0.4%] 6
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.1%] 6
All ❌✅ (primary) -0.2% [-0.5%, 0.3%] 8

Max RSS (memory usage)

Results (primary 1.9%, secondary 1.3%)

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

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

Cycles

Results (primary -3.0%, secondary -3.0%)

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

Binary size

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

Bootstrap: 489.147s -> 488.199s (-0.19%)
Artifact size: 388.47 MiB -> 388.92 MiB (0.12%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 9, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

Small regressions on two stress benchmarks from worker local arenas.
It's acceptable, and we'll need to integrate resolver into the parallel compiler sooner or later anyway.

@petrochenkov

Copy link
Copy Markdown
Contributor

The build reduced graph changes are potential micro-optimizations (that's where the diesel improvements come from), and the worker local changes are pessimizations, ideally they'd be benchmarked separately.

@LorrensP-2158466

Copy link
Copy Markdown
Contributor Author

Force-pushed the comments to keep it one commit. @rustbot ready

ideally they'd be benchmarked separately.

would you like 2 separate prs?

@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 Jul 10, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

would you like 2 separate prs?

Let's not complicate things and just merge.
@bors r+

@rust-bors

rust-bors Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 72e9ddc 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 10, 2026
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-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