-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Avoid unnecessary hashing #108794
Avoid unnecessary hashing #108794
Conversation
97166f5
to
b238d9c
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit b238d9c0b778a6034ad70473bda04ddd8b46760c with merge 8c17dc6956a284528df7e9916a2aa84ebfae0642... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8c17dc6956a284528df7e9916a2aa84ebfae0642): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking 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 @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
I realized that the crate hash is being computed in cases where it's not necessary (i.e. non-incremental builds of leaf crates). I'm now working on more changes to handle those cases, which bring more performance benefits. |
b238d9c
to
8953bf3
Compare
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 8953bf35baee8ab06f8ca297621bef253923136d with merge 25e8184a66493827bfc5cbe8d6e5114603d4e4ae... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (25e8184a66493827bfc5cbe8d6e5114603d4e4ae): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking 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 @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
} | ||
|
||
pub fn metadata_kind(&self) -> MetadataKind { | ||
self.crate_types() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although almost all current regressions are incremental so this isn't a factor, would it not be worth caching this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not showing up at all in profiles, so it's not worth optimizing.
8953bf3
to
ddc32a6
Compare
The CI x86_64-gnu-llvm-14 build is failing very early while building a stage 2 compiler. I can't reproduce this locally with commands like |
Aha, |
ddc32a6
to
5a8afdd
Compare
This is now ready for review. One thing about performance: there are lots of sub-1% icount regressions for unchanged/patched incremental runs on CI. I didn't see these in my local builds. I downloaded one of the CI builds and tried that for
I think the large improvements on the other scenarios justify these small (and possibly ephemeral) regressions. r? @cjgillot |
Could not assign reviewer from: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. That's some great savings. r=me with a comments on a few places.
The crate hash is needed: - if debug assertions are enabled, or - if incr. comp. is enabled, or - if metadata is being generated, or - if `-C instrumentation-coverage` is enabled. This commit avoids computing the crate hash when these conditions are all false, such as when doing a release build of a binary crate. It uses `Option` to store the hashes when needed, rather than computing them on demand, because some of them are needed in multiple places and computing them on demand would make compilation slower. The commit also removes `Owner::hash_without_bodies`. There is no benefit to pre-computing that one, it can just be done in the normal fashion.
5a8afdd
to
9570023
Compare
I have addressed the review comments. @bors r=cjgillot |
⌛ Testing commit 9570023 with merge 1a064760eee9b43c0645e23f647f87cd6ddee83d... |
💥 Test timed out |
@bors retry timeout |
☀️ Test successful - checks-actions |
Finished benchmarking commit (150cb38): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
I noticed some stable hashing being done in a non-incremental build. It turns out that some of this is necessary to compute the crate hash, but some of it is not. Removing the unnecessary hashing is a perf win.
r? @cjgillot