Skip to content

Use horde's SyncTable for default query caches and CtxtInterners#153826

Draft
Zoxc wants to merge 2 commits intorust-lang:mainfrom
Zoxc:horde-maps
Draft

Use horde's SyncTable for default query caches and CtxtInterners#153826
Zoxc wants to merge 2 commits intorust-lang:mainfrom
Zoxc:horde-maps

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Mar 13, 2026

This uses the hash map from my horde crate as the default query cache map and in CtxtInterners. The main benefit of it is that it offers lock-free reads.

This is a proper version of the test in #138419.

This adds a intermediary SyncTable type which uses our dynamic Lock instead of the always-on lock integrated in horde::SyncTable, as this avoids lock overhead for the -Zthreads=1 case.

This integrates the quiescent state based memory reclamation scheme by marking query execution as quiescent with collect and calling release when we're blocking.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 13, 2026
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 14, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 14, 2026
Use `horde`'s `SyncTable` for default query caches and `CtxtInterners`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 14, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 14, 2026

☀️ Try build successful (CI)
Build commit: 810b08b (810b08be87ff4ade9ca65bf4374cb14ff0468a37, parent: 620e36a8d1fc2f9e5694ce83c2631877651a962c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (810b08b): comparison URL.

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

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.4% [0.1%, 1.0%] 123
Regressions ❌
(secondary)
0.7% [0.1%, 1.9%] 129
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.9%, -0.1%] 12
All ❌✅ (primary) 0.4% [0.1%, 1.0%] 123

Max RSS (memory usage)

Results (secondary -9.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)
1.3% [0.8%, 2.0%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-11.6% [-15.2%, -1.0%] 16
All ❌✅ (primary) - - 0

Cycles

Results (primary 3.5%, secondary 3.5%)

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

mean range count
Regressions ❌
(primary)
3.5% [1.4%, 7.0%] 54
Regressions ❌
(secondary)
5.0% [1.9%, 8.9%] 60
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-7.3%, -2.7%] 11
All ❌✅ (primary) 3.5% [1.4%, 7.0%] 54

Binary size

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

Bootstrap: 483.729s -> 488.9s (1.07%)
Artifact size: 396.86 MiB -> 395.01 MiB (-0.47%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 14, 2026
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 15, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 15, 2026
Use `horde`'s `SyncTable` for default query caches and `CtxtInterners`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 15, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 15, 2026

☀️ Try build successful (CI)
Build commit: a20b8ea (a20b8ea6796c024e8171574fe9e57407f66541d1, parent: e0a8361373c88bd791b5b1335c6cbf83cd68e4d5)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a20b8ea): comparison URL.

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

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.1%, 0.7%] 86
Regressions ❌
(secondary)
0.6% [0.0%, 1.5%] 107
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 5
Improvements ✅
(secondary)
-0.3% [-0.9%, -0.0%] 28
All ❌✅ (primary) 0.3% [-0.3%, 0.7%] 91

Max RSS (memory usage)

Results (primary 2.6%, secondary -9.3%)

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

mean range count
Regressions ❌
(primary)
2.6% [2.6%, 2.6%] 1
Regressions ❌
(secondary)
0.8% [0.7%, 1.0%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-11.0% [-15.3%, -1.0%] 18
All ❌✅ (primary) 2.6% [2.6%, 2.6%] 1

Cycles

Results (primary 3.4%, 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)
3.4% [2.2%, 6.5%] 36
Regressions ❌
(secondary)
4.7% [1.6%, 7.3%] 51
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.5% [-7.1%, -2.0%] 12
All ❌✅ (primary) 3.4% [2.2%, 6.5%] 36

Binary size

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

Bootstrap: 480.839s -> 488.485s (1.59%)
Artifact size: 396.90 MiB -> 397.07 MiB (0.05%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-tidy Area: The tidy tool perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

3 participants