Skip to content

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

Open
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:horde-maps
Open

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

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Mar 13, 2026

View all comments

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
@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: fbe8224 (fbe822436088fa395ebd12435db3f96d3456d1b2, parent: 9e973d8850334be3fa3bcfb8ed2887d21485e92c)

@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: 3ecda27 (3ecda27879be15e793711696512e5874623c0681, parent: d27207d3d64a1399f90344d6ef3c5743204b3fd3)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3ecda27): 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.8%] 84
Regressions ❌
(secondary)
0.6% [0.0%, 1.9%] 108
Improvements ✅
(primary)
-0.2% [-0.3%, -0.1%] 6
Improvements ✅
(secondary)
-0.3% [-1.0%, -0.1%] 30
All ❌✅ (primary) 0.3% [-0.3%, 0.8%] 90

Max RSS (memory usage)

Results (secondary -10.7%)

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.9% [0.9%, 0.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-11.4% [-15.1%, -3.8%] 17
All ❌✅ (primary) - - 0

Cycles

Results (primary 3.2%, secondary 2.6%)

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

mean range count
Regressions ❌
(primary)
3.2% [1.4%, 5.5%] 37
Regressions ❌
(secondary)
4.6% [1.9%, 7.9%] 47
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.6% [-7.9%, -2.3%] 13
All ❌✅ (primary) 3.2% [1.4%, 5.5%] 37

Binary size

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

Bootstrap: 481.726s -> 488.008s (1.30%)
Artifact size: 394.80 MiB -> 397.03 MiB (0.56%)

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

Zoxc commented Mar 16, 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 16, 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 16, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 16, 2026

☀️ Try build successful (CI)
Build commit: 8107a7d (8107a7d016fb925dfd99c26c0011c2c4a9039f30, parent: 5b61449ed85a670f1dd3fca6a8c759ee0b451b66)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8107a7d): 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.2%, 0.7%] 6
Regressions ❌
(secondary)
0.4% [0.0%, 0.9%] 18
Improvements ✅
(primary)
-0.3% [-0.8%, -0.1%] 55
Improvements ✅
(secondary)
-0.4% [-0.8%, -0.1%] 82
All ❌✅ (primary) -0.2% [-0.8%, 0.7%] 61

Max RSS (memory usage)

Results (primary 0.5%, secondary -10.6%)

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

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-11.3% [-14.6%, -2.4%] 16
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Cycles

Results (primary 3.6%, secondary 2.2%)

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

mean range count
Regressions ❌
(primary)
3.6% [2.2%, 6.4%] 14
Regressions ❌
(secondary)
4.6% [2.0%, 6.7%] 22
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-5.0%, -2.2%] 9
All ❌✅ (primary) 3.6% [2.2%, 6.4%] 14

Binary size

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

Bootstrap: 481.08s -> 485.518s (0.92%)
Artifact size: 396.88 MiB -> 395.54 MiB (-0.34%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 16, 2026
@rust-log-analyzer

This comment has been minimized.

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 19, 2026

Results for 7 threads:

BenchmarkBeforeAfterBeforeAfterBeforeAfter
TimeTime%Physical MemoryPhysical Memory%Committed MemoryCommitted Memory%
🟣 clap:check0.3754s0.3661s💚 -2.47%204.75 MiB161.39 MiB💚 -21.18%274.62 MiB212.75 MiB💚 -22.53%
🟣 hyper:check0.1290s0.1168s💚 -9.47%127.63 MiB86.49 MiB💚 -32.23%195.84 MiB130.02 MiB💚 -33.61%
🟣 regex:check0.2774s0.2648s💚 -4.55%167.31 MiB121.57 MiB💚 -27.34%228.01 MiB162.14 MiB💚 -28.89%
🟣 syn:check0.5331s0.5166s💚 -3.09%198.50 MiB152.16 MiB💚 -23.34%260.45 MiB195.06 MiB💚 -25.10%
Total1.3149s1.2643s💚 -3.84%698.19 MiB521.61 MiB💚 -25.29%958.93 MiB699.98 MiB💚 -27.00%
Summary1.0000s0.9511s💚 -4.89%1 byte0.74 bytes💚 -26.02%1 byte0.72 bytes💚 -27.53%

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 19, 2026

We should probably do a crater run / ensure this has time to bake in nightly to get some test coverage on horde.

@Zoxc Zoxc marked this pull request as ready for review March 19, 2026 21:50
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2026

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

@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 Mar 19, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2026

r? @JohnTitor

rustbot has assigned @JohnTitor.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 14 candidates

@JohnTitor
Copy link
Member

@rustbot reroll

@rustbot rustbot assigned TaKO8Ki and unassigned JohnTitor Mar 19, 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-review Status: Awaiting review from the assignee but also interested parties. 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.

6 participants