Skip to content

Remove will_cache_on_disk_for_key_fn - #154591

Merged
rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
zetanumbers:refactor_query_fns_and_traits
May 30, 2026
Merged

Remove will_cache_on_disk_for_key_fn#154591
rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
zetanumbers:refactor_query_fns_and_traits

Conversation

@zetanumbers

@zetanumberszetanumbers commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

View all comments

Refactors QueryVtables and removes will_cache_on_disk_for_key_fn as unnecessary indirection.

Based and blocked on #154576.

Expecting perf improvements.

@rustbotrustbot 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 30, 2026
@lqd

lqd commented Mar 30, 2026

Copy link
Copy Markdown
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 30, 2026
@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 30, 2026
@rust-bors

rust-borsBot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 0f75a34 (0f75a344ce44035ffe18148c5886f45b63053573, parent: cf7da0b7277cad05b79f91b60c290aa08a17a6f0)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (0f75a34): 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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.8%[0.8%, 0.8%]1
Improvements ✅
(primary)
-0.1%[-0.1%, -0.1%]2
Improvements ✅
(secondary)
-0.3%[-0.6%, -0.2%]8
All ❌✅ (primary)-0.1%[-0.1%, -0.1%]2

Max RSS (memory usage)

Results (primary 4.0%, secondary 2.2%)

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

meanrangecount
Regressions ❌
(primary)
4.0%[4.0%, 4.0%]1
Regressions ❌
(secondary)
2.2%[2.2%, 2.2%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)4.0%[4.0%, 4.0%]1

Cycles

Results (primary 2.0%)

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

meanrangecount
Regressions ❌
(primary)
2.0%[2.0%, 2.0%]1
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)2.0%[2.0%, 2.0%]1

Binary size

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

Bootstrap: 483.836s -> 484.325s (0.10%)
Artifact size: 394.90 MiB -> 394.81 MiB (-0.02%)

@rustbotrustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 30, 2026
@Zalathar

Copy link
Copy Markdown
Member

Diff between the two perf runs: https://perf.rust-lang.org/compare.html?start=5a1a969187f4afe604cb916bc5740a09c5062f4b&end=0f75a344ce44035ffe18148c5886f45b63053573&stat=instructions%3Au

All of the “significicant” results look like they could be noise, unfortunately.

@zetanumbers

zetanumbers commented Mar 31, 2026

Copy link
Copy Markdown
ContributorAuthor

Diff between the two perf runs: https://perf.rust-lang.org/compare.html?start=5a1a969187f4afe604cb916bc5740a09c5062f4b&end=0f75a344ce44035ffe18148c5886f45b63053573&stat=instructions%3Au

All of the “significicant” results look like they could be noise, unfortunately.

Why would you think that? Every ctfe-stress-5 full build benchmark seems to improve besides the doc profile because its weird I guess. While every other ctfe-stress-5 benchmark (i.e. incremental unchanged and that doc build) didn't really regressed either.

https://perf.rust-lang.org/compare.html?start=5a1a969187f4afe604cb916bc5740a09c5062f4b&end=0f75a344ce44035ffe18148c5886f45b63053573&stat=instructions%3Au&nonRelevant=true&name=ctfe-stress-5

@zetanumbers

Copy link
Copy Markdown
ContributorAuthor

Either way this is also a refactor PR.

@rust-bors

This comment has been minimized.

@zetanumbers
zetanumbersforce-pushed the refactor_query_fns_and_traits branch from 9e740ff to aa17145CompareApril 1, 2026 10:22
@zetanumbers
zetanumbers marked this pull request as ready for review April 1, 2026 10:23
@rustbotrustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2026
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 1, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @jieyouxu

rustbot has assigned @jieyouxu.
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, query-system
  • compiler, query-system expanded to 69 candidates
  • Random selection from 12 candidates

@Zalathar

Copy link
Copy Markdown
Member

I don’t quite understand the motivation behind this as a cleanup.

It removes a function pointer from the vtable, but replaces it with two booleans in the vtable, which doesn’t strike me as an improvement over the current code.

Is there some reason to prefer the approach in this PR?

@jieyouxu

Copy link
Copy Markdown
Member

r? Zalathar (since you're already looking at it)

@rustbotrustbot assigned Zalathar and unassigned jieyouxuApr 1, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@zetanumbers

zetanumbers commented Apr 1, 2026

Copy link
Copy Markdown
ContributorAuthor

I don’t quite understand the motivation behind this as a cleanup.

It removes a function pointer from the vtable, but replaces it with two booleans in the vtable, which doesn’t strike me as an improvement over the current code.

Is there some reason to prefer the approach in this PR?

Pair of bools is smaller than one function pointer. Removes some dynamic dispatch. Less lines of code overall.

@rust-bors

This comment has been minimized.

@cjgillotcjgillot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment threadcompiler/rustc_middle/src/query/plumbing.rs Outdated
@zetanumbers
zetanumbersforce-pushed the refactor_query_fns_and_traits branch from aa17145 to 239e4ddCompareMay 26, 2026 08:43
@rustbot

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@zetanumbers

Copy link
Copy Markdown
ContributorAuthor

Since #155080 have been merged this PR might now have a more significant impact on perf.

@cjgillotcjgillot self-assigned this May 29, 2026
@cjgillot

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 29, 2026
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request May 29, 2026
@rust-bors

rust-borsBot commented May 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: aee8937 (aee89370c1190ed73a83e9fe0c453e894c0bbe7d, parent: 6368fd52cb9f230dfb156097625993e7a8891800)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (aee8937): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary 3.1%, secondary -5.4%)

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

meanrangecount
Regressions ❌
(primary)
3.1%[3.1%, 3.1%]1
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-5.4%[-5.4%, -5.4%]1
All ❌✅ (primary)3.1%[3.1%, 3.1%]1

Cycles

Results (secondary 5.7%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.7%[5.1%, 6.7%]3
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

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

Bootstrap: 511.654s -> 509.773s (-0.37%)
Artifact size: 400.70 MiB -> 400.68 MiB (-0.01%)

@rustbotrustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels May 29, 2026
@cjgillot

Copy link
Copy Markdown
Contributor

@bors r+ rollup-

@rust-bors

rust-borsBot commented May 30, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9d82fce has been approved by cjgillot

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1. This pull request will be tested once the tree is reopened.

@rust-borsrust-borsBot 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 May 30, 2026
rust-borsBot pushed a commit that referenced this pull request May 30, 2026
…uwer
Rollup of 12 pull requests
Successful merges:
- #154591 (Remove `will_cache_on_disk_for_key_fn`)
- #156672 (Misc improvements to coroutine transform code)
- #157027 (HIR ty lowering: Move some things into submodules)
- #157051 (Allow two object files for a single CGU in CompiledModule)
- #157100 (Some more per owner things)
- #153497 (Use `trait_object_dummy_self` more & heavily fix+update related docs)
- #155638 (Fix tupled closure signature in `AsyncFn` arg mismatch diagnostic)
- #156826 (style: Clarify nullary call and `()` no-break rule applies past max width)
- #157004 (Remove unused functions in `value_analysis.rs`)
- #157032 (Fixed more &x ->&mut x suggestions)
- #157033 (Note irrefutable while let in loop type errors)
- #157139 (compiler: `ops::RangeInclusive` → `range::RangeInclusive`)
Failed merges:
- #156875 (Correct and document semantics of `yield` terminator)
@rust-bors
rust-borsBot merged commit e8659d7 into rust-lang:mainMay 30, 2026
13 checks passed
@rustbotrustbot added this to the 1.98.0 milestone May 30, 2026
rust-timer added a commit that referenced this pull request May 30, 2026
Rollup merge of #154591 - zetanumbers:refactor_query_fns_and_traits, r=cjgillot
Remove `will_cache_on_disk_for_key_fn`
Refactors `QueryVtables` and removes `will_cache_on_disk_for_key_fn` as unnecessary indirection.
Based and blocked on #154576.
Expecting perf improvements.
@zetanumbers
zetanumbers deleted the refactor_query_fns_and_traits branch June 1, 2026 08:36
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

7 participants

@zetanumbers@lqd@rust-timer@Zalathar@rustbot@jieyouxu@cjgillot