-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Caching the stable hash of Ty within itself #94299
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 85ce0ec1f2ad3b14f46b87a663330217830e13e4 with merge 8350f52e17c0d97bcd0b122bd425c51eefd7be22... |
☀️ Try build successful - checks-actions |
Queued 8350f52e17c0d97bcd0b122bd425c51eefd7be22 with parent c651ba8, future comparison URL. |
Finished benchmarking commit (8350f52e17c0d97bcd0b122bd425c51eefd7be22): comparison url. Summary: This benchmark run shows 131 relevant improvements 🎉 but 103 relevant regressions 😿 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. 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 led 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 |
Fingerprint caching has to take into account that there can be different hash settings. See #92278, for example. I think we'll want to get rid of these settings eventually (or somehow assert that they are fully determined by the type that's being hashed) but until then we have to expect that there can be multiple fingerprints per value. I'm wondering if, instead of caching hashes per type, it would be better to build fingerprint caching into a |
Jup, that was my plan. Possibly along with type flags which are often also shared there |
It seems like an overall performance win. The regression all seem to be in non-incremental mode, in which we usually don't compute these fingerprints (except for legacy symbol mangling). |
5477820
to
8b0440a
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 8b0440a with merge a432345cd8a7c2f366eb9e829f27092c074862d7... |
☀️ Try build successful - checks-actions |
Queued a432345cd8a7c2f366eb9e829f27092c074862d7 with parent 7ccfe2f, future comparison URL. |
I'm interested to hear your thoughts on what this will look like in an eventual I think the wins here a pretty solid, but I'm a bit uneasy on encoding something specific to the rustc encoding into the Ty representation. |
I am working locally on moving this information into the interner, but that has a bigger diff and I want to do it separately from this PR anyway so we can have clear perf numbers. |
💥 Test timed out |
@bors retry timeout |
☀️ Test successful - checks-actions |
Finished benchmarking commit (8d6f527): comparison url. Summary: This benchmark run shows 120 relevant improvements 🎉 but 12 relevant regressions 😿 to instruction counts.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression |
@rustbot label: +perf-regression-triaged The improvements outweigh the regressions significantly both in number of tests and in the magnitude |
I am currently working on using I also have some concerns about memory usage. Types like |
Considering my experiments in #94487 it does not seem like this is generally useful within Interned yet. I can write up a doc of all the experiments that I have planned and then we can talk about whether it makes sense to continue with caching stable hashes. Wrt memory usage, https://perf.rust-lang.org/compare.html?start=4ce3749235fc31d15ebd444b038a9877e8c700d7&end=8d6f527530f4ba974d922269267fe89050188789&stat=max-rss looks just like any PR to me. Some ups, some downs, no concrete change in maximum memory usage |
Also cache the stable hash of interned Predicates continuation of rust-lang#94299 This is a small perf improvement and shares more code between `Ty` and `Predicate`
Also cache the stable hash of interned Predicates continuation of rust-lang/rust#94299 This is a small perf improvement and shares more code between `Ty` and `Predicate`
Instead of computing stable hashes on types as needed, we compute it during interning.
This way we can, when a hash is requested, just hash that hash, which is significantly faster than traversing the type itself.
We only do this for incremental for now, as incremental is the only frequent user of stable hashing.
As a next step we can try out