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

In LexicalResolver, don't construct graph unless necessary. #110527

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

nnethercote
Copy link
Contributor

A small but easy perf win.

r? @jackh726

@rustbot rustbot added 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 Apr 19, 2023
@nnethercote
Copy link
Contributor Author

@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 Apr 19, 2023
@bors
Copy link
Contributor

bors commented Apr 19, 2023

⌛ Trying commit 8e6c9e0 with merge 6afef3bc826bb1dbbb61b0357520d5233e630105...

@lqd
Copy link
Member

lqd commented Apr 19, 2023

r=me with the expected perf improvement

@bors
Copy link
Contributor

bors commented Apr 19, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6afef3bc826bb1dbbb61b0357520d5233e630105): 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.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.7%, -0.2%] 11
All ❌✅ (primary) 0.6% [0.6%, 0.6%] 1

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

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.3% [-2.4%, -2.2%] 2
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 Apr 19, 2023
@lqd
Copy link
Member

lqd commented Apr 19, 2023

The cargo incr regression looks unrelated (and in a scenario we don't deploy), about encoding/decoding, while the wins are defo in the lexical resolver.

 79,826,049  ???:rustc_middle::ty::codec::encode_with_shorthand::<rustc_query_impl::on_disk_cache::CacheEncoder, rustc_middle::ty::Ty, <rustc_query_impl::on_disk_cache::CacheEncoder as rustc_type_ir::codec::TyEncoder>::type_shorthands>
-45,260,416  ???:<std::collections::hash::map::HashMap<rustc_hir::hir_id::ItemLocalId, rustc_middle::ty::Ty, core::hash::BuildHasherDefault<rustc_hash::FxHasher>> as rustc_serialize::serialize::Encodable<rustc_query_impl::on_disk_cache::CacheEncoder>>::encode
 24,158,243  ???:llvm::FPPassManager::runOnModule(llvm::Module&)
 21,446,668  <all-jemalloc-files>:<all-jemalloc-functions>
-19,908,056  ???:<rustc_middle::ty::subst::GenericArg as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
-14,140,935  ???:<std::collections::hash::map::HashMap<rustc_hir::hir_id::ItemLocalId, alloc::vec::Vec<rustc_middle::ty::adjustment::Adjustment>, core::hash::BuildHasherDefault<rustc_hash::FxHasher>> as rustc_serialize::serialize::Encodable<rustc_query_impl::on_disk_cache::CacheEncoder>>::encode
 13,388,280  ???:<rustc_query_impl::on_disk_cache::CacheDecoder as rustc_type_ir::codec::TyDecoder>::cached_ty_for_shorthand::<<rustc_middle::ty::Ty as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode::{closure#0}>
 13,322,106  ???:<[rustc_middle::ty::subst::GenericArg] as rustc_serialize::serialize::Encodable<rustc_query_impl::on_disk_cache::CacheEncoder>>::encode
 13,185,582  ???:<&rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg> as rustc_serialize::serialize::Decodable<rustc_query_impl::on_disk_cache::CacheDecoder>>::decode
...

@nnethercote
Copy link
Contributor Author

Weird results. It's easier to focus on just the full check measurements:

The best results are better in #110527, e.g. unused-warnings improves from -0.58% to -0.72, and libc-0.2.124 improves from -0.11% to -0.22%. Which aligns with what I saw locally, and makes logical sense: this PR is simply doing less work. But the results for #110520 are more uniformly green.

@nnethercote
Copy link
Contributor Author

I will try another perf run, to see what happens.

@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 Apr 19, 2023
@bors
Copy link
Contributor

bors commented Apr 19, 2023

⌛ Trying commit 8e6c9e0 with merge 2085cd2cd2f0c42c70e3d0fe60fcbb25036397e9...

@bors
Copy link
Contributor

bors commented Apr 20, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2085cd2cd2f0c42c70e3d0fe60fcbb25036397e9): 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
Improvements ✅
(secondary)
-0.5% [-0.7%, -0.4%] 5
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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

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.7% [0.7%, 0.7%] 1
Regressions ❌
(secondary)
2.8% [2.6%, 3.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.7%, 0.7%] 1

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Apr 20, 2023
@nnethercote
Copy link
Contributor Author

Latest results are better, showing that the supposed sub-significance-threshold reds were just noise. I think it's reasonable to merge this now.

@bors r=lqd

@bors
Copy link
Contributor

bors commented Apr 20, 2023

📌 Commit 8e6c9e0 has been approved by lqd

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 Apr 20, 2023
@bors
Copy link
Contributor

bors commented Apr 20, 2023

⌛ Testing commit 8e6c9e0 with merge 23a76a8...

@bors
Copy link
Contributor

bors commented Apr 20, 2023

☀️ Test successful - checks-actions
Approved by: lqd
Pushing 23a76a8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 20, 2023
@bors bors merged commit 23a76a8 into rust-lang:master Apr 20, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 20, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (23a76a8): 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.3% [-0.4%, -0.2%] 4
Improvements ✅
(secondary)
-0.4% [-0.8%, -0.2%] 11
All ❌✅ (primary) -0.3% [-0.4%, -0.2%] 4

Max RSS (memory usage)

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

Cycles

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

@nnethercote nnethercote deleted the lazy-graph branch April 20, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants