-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Improve caching during trait evaluation #86946
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
Conversation
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit f2233a62c193f9d81391ce078821a92226d6562a with merge e0077e80d6baf40bb5ea72ad1b936ed2d24c76c6... |
☀️ Try build successful - checks-actions |
Queued e0077e80d6baf40bb5ea72ad1b936ed2d24c76c6 with parent c5e344f, future comparison URL. |
Finished benchmarking try commit (e0077e80d6baf40bb5ea72ad1b936ed2d24c76c6): comparison url. Summary: This change led to significant improvements 🎉 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. @bors rollup=never |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit f8ac29b10e698d1ab743b1e068d77d13459e78ef with merge 8755dc80ab36003a2c81d2ef6e4cc4c81221d6f2... |
☀️ Try build successful - checks-actions |
Queued 8755dc80ab36003a2c81d2ef6e4cc4c81221d6f2 with parent d2b04f0, future comparison URL. |
Finished benchmarking try commit (8755dc80ab36003a2c81d2ef6e4cc4c81221d6f2): comparison url. Summary: This change led to significant improvements 🎉 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. @bors rollup=never |
f8ac29b
to
f61df37
Compare
This is now ready for review. |
f61df37
to
2239ae7
Compare
@bors r+ |
📌 Commit 2239ae7f5f9d879605f64833014c86eeeb6caec4 has been approved by |
⌛ Testing commit 2239ae7f5f9d879605f64833014c86eeeb6caec4 with merge 2466754cfcf5376eb61c757d7cabffe82d0587c6... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
Previously, we would 'forget' that we had `'static` regions in some place during trait evaluation. This lead to us producing `EvaluatedToOkModuloRegions` when we could have produced `EvaluatedToOk`, causing us to perform unnecessary work. This PR preserves `'static` regions when we canonicalize a predicate for `evaluate_obligation`, and when we 'freshen' a predicate during trait evaluation. Thie ensures that evaluating a predicate containing `'static` regions can produce `EvaluatedToOk` (assuming that we don't end up introducing any region dependencies during evaluation). Building off of this improved caching, we use `predicate_must_hold_considering_regions` during fulfillment of projection predicates to see if we can skip performing additional work. We already do this for trait predicates, but doing this for projection predicates lead to mixed performance results without the above caching improvements.
2239ae7
to
3291218
Compare
@bors r=nikomatsakis |
📌 Commit 3291218 has been approved by |
☀️ Test successful - checks-actions |
Previously, we would 'forget' that we had
'static
regions in someplace during trait evaluation. This lead to us producing
EvaluatedToOkModuloRegions
when we could have producedEvaluatedToOk
, causing us to perform unnecessary work.This PR preserves
'static
regions when we canonicalize a predicate forevaluate_obligation
, and when we 'freshen' a predicate during traitevaluation. Thie ensures that evaluating a predicate containing
'static
regions can produceEvaluatedToOk
(assuming that wedon't end up introducing any region dependencies during evaluation).
Building off of this improved caching, we use
predicate_must_hold_considering_regions
during fulfillment ofprojection predicates to see if we can skip performing additional work.
We already do this for trait predicates, but doing this for projection
predicates lead to mixed performance results without the above caching
improvements.