-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Eliminate ObligationCauseData
#91844
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit ddb96eb0b1587c670438b0e577eb709c90e29447 with merge 220db1ba07e4e16cdbe3889232735221018fe852... |
This comment has been minimized.
This comment has been minimized.
72588bb
to
748ccba
Compare
@bors try |
⌛ Trying commit 748ccba835c1336c51462525d136e2314289a284 with merge 498fbcc6241318ce8d97f067af15d4fba425d18b... |
☀️ Try build successful - checks-actions |
Queued 498fbcc6241318ce8d97f067af15d4fba425d18b with parent f7fd79a, future comparison URL. |
Finished benchmarking commit (498fbcc6241318ce8d97f067af15d4fba425d18b): comparison url. Summary: This change led to large relevant mixed results 🤷 in compiler performance.
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 |
Lots more wins than losses among the instruction counts, plus it's a tiny reduction in number of lines of code. I think this is worth going ahead with. |
I agree that these wins exceed the regressions, so this is worth it. I am wondering, though, if it makes sense to try to go further here. In particular, it seems to me that many ObligationCauseCode's are or could be <= one pointer in "size", in which case For example, just by moving the discriminant into the Obligation (one extra byte), we'd be able to represent a lot of the variants inline -- trivially all of the ones that have no data attached, and in theory those which have data that's only usize wide (e.g., a single DefId). I don't off-hand know what the distribution there looks like -- this PR adds a comment suggesting this covers 60% of cases with just MiscObligation, but it's worth noting that we keep adding new obligation cause codes, so presumably that percentage is only going to decrease over time. I'm not sure what the distribution on the rest of the codes is like. Further optimization seems fine to leave for future PRs, but I would like the comment on the Option discriminant hashing addressed; r=me with that done (another perf run may be in order). |
⌛ Testing commit 47d6bdfd7b00e28839d261f1c7a9de190560079f with merge d985d42bb4d0910b017e761acb7125427ce7aef2... |
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #92099) made this pull request unmergeable. Please resolve the merge conflicts. |
47d6bdf
to
d7ca962
Compare
📌 Commit d7ca962282ccc09fad6c8193fa3a474e339097c5 has been approved by |
This comment has been minimized.
This comment has been minimized.
This makes `Obligation` two words bigger, but avoids allocating a lot of the time. I previously tried this in rust-lang#73983 and it didn't help much, but local timings look more promising now.
d7ca962
to
f09b1fa
Compare
@bors r=Mark-Simulacrum |
📌 Commit f09b1fa has been approved by |
☀️ Test successful - checks-actions |
I did some quick measurements and the potential for improvement here seems very low. The simple variants account for a small fraction (~5% or less) of the occurrences seen in practice (while compiling |
Finished benchmarking commit (ed7a206): comparison url. Summary: This change led to small relevant mixed results 🤷 in compiler performance.
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 |
This makes
Obligation
two words bigger, but avoids allocating a lot of the time.I previously tried this in #73983 and it didn't help much, but local timings look more promising now.
r? @ghost