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

Move dep graph methods to DepGraphData to avoid branches and unwraps #108417

Merged
merged 3 commits into from
Mar 12, 2023

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 24, 2023

This moves methods from DepGraph to DepGraphData which makes the code a bit cleaner since the dep graph is unconditionally available. It also changes try_execute_query to only branch on dep graph availability once, removing unnecessary branches and unwraps.

This is based on #108134 and #108167.

Performance impact of just the last commit:

BenchmarkBeforeAfter
TimeTime%
🟣 clap:check1.7354s1.7242s -0.64%
🟣 clap:check:initial2.0813s2.0687s -0.61%
🟣 clap:check:unchanged0.4554s0.4550s -0.09%
🟣 hyper:check0.2528s0.2521s -0.27%
🟣 hyper:check:initial0.3222s0.3214s -0.25%
🟣 hyper:check:unchanged0.1339s0.1333s -0.38%
🟣 regex:check0.9484s0.9455s -0.30%
🟣 regex:check:initial1.1805s1.1727s -0.66%
🟣 regex:check:unchanged0.3305s0.3307s 0.08%
🟣 syn:check1.5453s1.5374s -0.51%
🟣 syn:check:initial1.9230s1.9206s -0.12%
🟣 syn:check:unchanged0.6340s0.6333s -0.11%
🟣 syntex_syntax:check5.8623s5.8536s -0.15%
🟣 syntex_syntax:check:initial7.2873s7.2786s -0.12%
🟣 syntex_syntax:check:unchanged1.8378s1.8478s 0.54%
Total26.5300s26.4750s -0.21%
Summary1.0000s0.9976s -0.24%

r? @cjgillot

@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 Feb 24, 2023
@compiler-errors
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

bors commented Feb 24, 2023

⌛ Trying commit 6b4f27c51351ef768bb7ddc3aff09e982afffb21 with merge bff7140d585f96ac6c42e840640b8ea26053e262...

@compiler-errors
Copy link
Member

compiler-errors commented Feb 24, 2023

Performance impact of just the last commit

I guess maybe the rust-timer invocation was premature, since it'll also reflect any perf from those other commits. Anyways, let's see what perf says regardless.

@bors
Copy link
Contributor

bors commented Feb 24, 2023

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

1 similar comment
@bors
Copy link
Contributor

bors commented Feb 24, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bff7140d585f96ac6c42e840640b8ea26053e262): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -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.5% [0.3%, 1.4%] 18
Regressions ❌
(secondary)
1.0% [0.1%, 2.6%] 20
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 4
All ❌✅ (primary) 0.5% [0.3%, 1.4%] 18

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)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-2.1%, 2.4%] 2

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

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 24, 2023
Copy link
Contributor

@bryangarza bryangarza left a comment

Choose a reason for hiding this comment

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

Not an official reviewer but here's some feedback

compiler/rustc_query_impl/src/plumbing.rs Outdated Show resolved Hide resolved
compiler/rustc_query_system/src/dep_graph/graph.rs Outdated Show resolved Hide resolved
@cjgillot
Copy link
Contributor

Could you remove all-but-last commits from this PR? This refactor makes a lot of sense, and I'd like to merge it. But it's perf effect is polluted by the other commits.

@rust-log-analyzer

This comment has been minimized.

@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 7, 2023
@Zoxc Zoxc force-pushed the dep-graph-branch branch from 60b71e2 to df7a50e Compare March 8, 2023 15:04
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 8, 2023

This can get a proper perf run now.

@lqd
Copy link
Member

lqd commented Mar 8, 2023

(note that as a former t-compiler member you can ask for your status and bors rights back)

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 8, 2023

⌛ Trying commit df7a50e929c7f5bd575a9f4e1ba0b2c60308620e with merge 4afbe51acc449e8835d24531702a6a71c5e97c04...

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

bors commented Mar 8, 2023

☀️ Try build successful - checks-actions
Build commit: 4afbe51acc449e8835d24531702a6a71c5e97c04 (4afbe51acc449e8835d24531702a6a71c5e97c04)

@rust-timer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Mar 8, 2023

☀️ Try build successful - checks-actions
Build commit: 4afbe51acc449e8835d24531702a6a71c5e97c04 (4afbe51acc449e8835d24531702a6a71c5e97c04)

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4afbe51acc449e8835d24531702a6a71c5e97c04): 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-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.2% [-0.4%, -0.2%] 10
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.2%] 9
All ❌✅ (primary) -0.2% [-0.4%, -0.2%] 10

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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.2%, -2.0%] 2
All ❌✅ (primary) - - 0

Cycles

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

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Mar 8, 2023
@Zoxc Zoxc force-pushed the dep-graph-branch branch from df7a50e to 42a0aaa Compare March 9, 2023 07:12
@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 9, 2023

@rustbot label -S-waiting-on-author +S-waiting-on-review

@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 9, 2023
@cjgillot
Copy link
Contributor

cjgillot commented Mar 9, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Mar 9, 2023

📌 Commit 42a0aaa has been approved by cjgillot

It is now in the queue for this repository.

@bors bors 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 Mar 9, 2023
@bors
Copy link
Contributor

bors commented Mar 11, 2023

⌛ Testing commit 42a0aaa with merge 542ed2b...

@bors
Copy link
Contributor

bors commented Mar 12, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 542ed2b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 12, 2023
@bors bors merged commit 542ed2b into rust-lang:master Mar 12, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 12, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (542ed2b): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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.2% [-0.3%, -0.2%] 6
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.2%] 5
All ❌✅ (primary) -0.2% [-0.3%, -0.2%] 6

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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.3%, -2.0%] 2
All ❌✅ (primary) - - 0

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)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.3%, -1.9%] 4
All ❌✅ (primary) - - 0

@Zoxc Zoxc deleted the dep-graph-branch branch March 12, 2023 08:39
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.

10 participants