Skip to content

Store dep_kind_vtables in an array inside QuerySystem#153950

Draft
Zalathar wants to merge 2 commits intorust-lang:mainfrom
Zalathar:dep-kind-vtables
Draft

Store dep_kind_vtables in an array inside QuerySystem#153950
Zalathar wants to merge 2 commits intorust-lang:mainfrom
Zalathar:dep-kind-vtables

Conversation

@Zalathar
Copy link
Member

This should hopefully avoid a bounds-check and indirection on every DepKindVTable lookup, and also makes query system init a little nicer.

This commit also changes the type of `DepKind::NUM_VARIANTS` to `usize`, which
is important for the next commit.
@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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 Mar 16, 2026
@Zalathar
Copy link
Member Author

@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
Store `dep_kind_vtables` in an array inside `QuerySystem`
@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: e73bdda (e73bddaca21d935693863670e21052a90fd15a1e, parent: fe7294f8793d001bc3f9d197e7cdef6cdb46c15a)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e73bdda): 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.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.2% [-0.3%, -0.0%] 59
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 29
All ❌✅ (primary) -0.2% [-0.3%, -0.0%] 59

Max RSS (memory usage)

Results (primary -0.6%, secondary -2.9%)

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

mean range count
Regressions ❌
(primary)
0.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
0.7% [0.7%, 0.7%] 1
Improvements ✅
(primary)
-1.8% [-1.8%, -1.8%] 1
Improvements ✅
(secondary)
-3.6% [-6.9%, -1.0%] 5
All ❌✅ (primary) -0.6% [-1.8%, 0.6%] 2

Cycles

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

Binary size

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

Bootstrap: 482.3s -> 482.558s (0.05%)
Artifact size: 394.83 MiB -> 396.83 MiB (0.51%)

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

Looks like a very modest across-the-board perf win.

I would be reluctant to accept that for a PR that added complexity in the name of performance, but since this PR is aiming to reduce complexity, getting a slim perf boost is a nice bonus.

@Zalathar
Copy link
Member Author

It would be nice to make the DepKindVTable array fully static, but that might require #![feature(external_item_impls)] since we want to define it downstream in rustc_query_impl.

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 24, 2026

☔ The latest upstream changes (presumably #154289) made this pull request unmergeable. Please resolve the merge conflicts.

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) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants