Skip to content

Comments

Streamline QueryVTableUnerased into GetQueryVTable#152841

Open
Zalathar wants to merge 1 commit intorust-lang:mainfrom
Zalathar:unerased
Open

Streamline QueryVTableUnerased into GetQueryVTable#152841
Zalathar wants to merge 1 commit intorust-lang:mainfrom
Zalathar:unerased

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Feb 19, 2026

View all comments

QueryDispatcherUnerased is an awkward name for an awkward trait.

We can make it a bit more straightforward by removing its responsibility for erasing query values, and by observing that its only real responsibility beyond that is to know how to obtain the vtable for a particlar query from tcx.

@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 Feb 19, 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 Feb 19, 2026
Streamline `QueryVTableUnerased` into `QueryVTableGetter`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 19, 2026
@Zalathar
Copy link
Member Author

/// Marker type that implements [`QueryVTableGetter`] for this query.
pub(crate) enum VTableGetter {}

impl<'tcx> QueryVTableGetter<'tcx, FLAGS> for VTableGetter {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a trait with a single implementer (per query).
Would it be hard to refactor it into a free (per query) function somehow?
(Similarly to how restore_val was removed from the trait's interface.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Using a free function seems tricky, because the generics needed per callee would get more complicated, and that's something I'm trying to cut down on.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 19, 2026

☀️ Try build successful (CI)
Build commit: b46d288 (b46d288105b795d2d5f97fe4d4e7edc8076a0796, parent: fbd6934114e905d3cc61adbbd7e4a355eac5d0d7)

@rust-timer

This comment has been minimized.

@rust-timer

This comment was marked as outdated.

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 19, 2026
@Zalathar
Copy link
Member Author

Looks like I need to try some permutations to track down what’s triggering the perf changes.

@Zalathar Zalathar changed the title Streamline QueryVTableUnerased into QueryVTableGetter Streamline QueryVTableUnerased into GetQueryVTable Feb 20, 2026
@Zalathar
Copy link
Member Author

The current iteration only changes the trait itself and encode_query_results, without touching the DepKindVTable functions. I'm hoping that this will be perf-neutral.

@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 Feb 20, 2026
Streamline `QueryVTableUnerased` into `GetQueryVTable`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 20, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 20, 2026

☀️ Try build successful (CI)
Build commit: f16cfc0 (f16cfc0ab2d20a448e430f462e86b78b6b8c0928, parent: ef70767064ab87b0a41400f69e1dc0b55c8d5284)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f16cfc0): comparison URL.

Overall result: ❌✅ regressions and 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)
1.5% [1.5%, 1.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 3.7%)

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

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

Cycles

Results (primary 2.5%)

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

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

Binary size

Results (primary 0.0%, secondary 0.0%)

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

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 6
Regressions ❌
(secondary)
0.0% [0.0%, 0.1%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 6

Bootstrap: 496.246s -> 482.423s (-2.79%)
Artifact size: 397.86 MiB -> 397.86 MiB (-0.00%)

@rustbot rustbot removed perf-regression Performance regression. S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 20, 2026
@rust-bors

This comment has been minimized.

@Zalathar
Copy link
Member Author

Let's see what perf looks like after removing const FLAGS.

@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 Feb 24, 2026
Streamline `QueryVTableUnerased` into `GetQueryVTable`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 24, 2026
@Zalathar
Copy link
Member Author

r? nnethercote (or compiler)

@Zalathar Zalathar marked this pull request as ready for review February 24, 2026 01:19
@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 Feb 24, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 24, 2026

☀️ Try build successful (CI)
Build commit: f8e0d28 (f8e0d280371623a57b0d3cfead4cb65d3f9e15e1, parent: b3869b94cd1ed4bfa2eb28f301535d5e9599c713)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f8e0d28): 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
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 1.1%, secondary 4.5%)

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

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
4.5% [4.5%, 4.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.1% [1.1%, 1.1%] 1

Cycles

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

Binary size

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

Bootstrap: 479.41s -> 479.13s (-0.06%)
Artifact size: 395.68 MiB -> 397.73 MiB (0.52%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 24, 2026
@nnethercote
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 24, 2026

📌 Commit 16fbd29 has been approved by nnethercote

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 Feb 24, 2026
@Zalathar
Copy link
Member Author

These changes should have no perf effects, and the most recent perf run only shows noise, so this PR seems safe for rollup.

@bors rollup=maybe

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 24, 2026
Streamline `QueryVTableUnerased` into `GetQueryVTable`

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152841)*

`QueryDispatcherUnerased` is an awkward name for an awkward trait.

We can make it a bit more straightforward by removing its responsibility for erasing query values, and by observing that its only real responsibility beyond that is to know how to obtain the vtable for a particlar query from `tcx`.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 24, 2026
Streamline `QueryVTableUnerased` into `GetQueryVTable`

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152841)*

`QueryDispatcherUnerased` is an awkward name for an awkward trait.

We can make it a bit more straightforward by removing its responsibility for erasing query values, and by observing that its only real responsibility beyond that is to know how to obtain the vtable for a particlar query from `tcx`.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 24, 2026
Streamline `QueryVTableUnerased` into `GetQueryVTable`

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152841)*

`QueryDispatcherUnerased` is an awkward name for an awkward trait.

We can make it a bit more straightforward by removing its responsibility for erasing query values, and by observing that its only real responsibility beyond that is to know how to obtain the vtable for a particlar query from `tcx`.
rust-bors bot pushed a commit that referenced this pull request Feb 24, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #152176 (Neon fast path for str::contains)
 - #152657 (std: move `exit` out of PAL)
 - #152841 (Streamline `QueryVTableUnerased` into `GetQueryVTable`)
 - #152845 (Skip `tidy` in PR CI jobs not dedicated to running `tidy`)
 - #152897 (Add optional json logging)
 - #153009 (Remove `rustc_feedable_queries` and `define_feedable` macros.)
 - #151558 (Port diagnostic attributes)
 - #152492 (mGCA: Enforce WF element types for array valtrees)
 - #152888 (Fix async drop glue MIR bug)
 - #152988 (Port `#[register_tool]` to the new attribute system)
 - #153018 (`unused_must_use` lint improvements)
 - #153023 (Update books)
 - #153033 (Clarify how "ensure" queries check whether they can skip execution)
 - #153043 (fix error on missing value for -C flags)
 - #153045 (rustc-dev-guide subtree update)

Failed merges:

 - #153032 (Fix attribute parser and kind names.)
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-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