Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an IndexVec to cache queries with index-like key #103808

Merged
merged 5 commits into from
Nov 24, 2022

Conversation

cjgillot
Copy link
Contributor

Revival of an old idea. Let's see if it has more effect.

r? @ghost

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 31, 2022
@cjgillot
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 31, 2022
@bors
Copy link
Contributor

bors commented Oct 31, 2022

⌛ Trying commit 7491dfd1c506a6a76d60665ababe8a151018448d with merge 2e7c76e9d2ca0771983633c6e962d0826c6b2172...

@bors
Copy link
Contributor

bors commented Oct 31, 2022

☀️ Try build successful - checks-actions
Build commit: 2e7c76e9d2ca0771983633c6e962d0826c6b2172 (2e7c76e9d2ca0771983633c6e962d0826c6b2172)

@rust-timer
Copy link
Collaborator

Queued 2e7c76e9d2ca0771983633c6e962d0826c6b2172 with parent 2afca78, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2e7c76e9d2ca0771983633c6e962d0826c6b2172): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.8% [-2.4%, -0.2%] 150
Improvements ✅
(secondary)
-1.1% [-6.8%, -0.3%] 101
All ❌✅ (primary) -0.8% [-2.4%, -0.2%] 150

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.2% [0.6%, 1.7%] 17
Regressions ❌
(secondary)
6.2% [2.3%, 9.5%] 19
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-2.8% [-3.7%, -1.6%] 5
All ❌✅ (primary) 1.1% [-0.6%, 1.7%] 18

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.9% [-8.0%, -1.2%] 63
Improvements ✅
(secondary)
-4.9% [-10.6%, -2.1%] 36
All ❌✅ (primary) -2.9% [-8.0%, -1.2%] 63

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 31, 2022
@cjgillot
Copy link
Contributor Author

r? @Aaron1011

use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{Span, DUMMY_SP};

/// The `Key` trait controls what types can legally be used as the key
/// for a query.
pub trait Key {
type CacheSelector;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type CacheSelector;
type CacheSelector = DefaultCacheSelector<Self>;

Seems reasonable to set a default here.

@cjgillot
Copy link
Contributor Author

r? compiler

@rustbot rustbot assigned TaKO8Ki and unassigned Aaron1011 Nov 23, 2022
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Nov 24, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Nov 24, 2022

📌 Commit bc9a202 has been approved by TaKO8Ki

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 24, 2022
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 24, 2022
@bors
Copy link
Contributor

bors commented Nov 24, 2022

⌛ Testing commit bc9a202 with merge 341d8b8...

@bors
Copy link
Contributor

bors commented Nov 24, 2022

☀️ Test successful - checks-actions
Approved by: TaKO8Ki
Pushing 341d8b8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 24, 2022
@bors bors merged commit 341d8b8 into rust-lang:master Nov 24, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 24, 2022
@cjgillot cjgillot deleted the vec-cache branch November 24, 2022 11:02
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 16, 2022
Help rust-analyzer normalize query return types

See [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/rustc.20query.20types.20are.20not.20normalized.20since.20recently/near/312686086), since rust-lang#103808, rust analyzer doesn't normalize return types of queries. This is because r-a doesn't support associated type defaults (yet).

The easiest fix is to not use associated type defaults (duh), which this PR does.

r? `@cjgillot`
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
Use an IndexVec to cache queries with index-like key

Revival of an old idea. Let's see if it has more effect.

r? `@ghost`
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) merged-by-bors This PR was explicitly merged by bors. 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.

7 participants