-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Eliminate ObligationCauseData
.
#73983
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
PR rust-lang#72962 shrank `Obligation` at the cost of more heap allocations; overall it was a perf win. This PR partly undoes that change, making `Obligation` a little bigger (though not as big as it was) while reducing the number of heap allocations.
Local measurements gave mixed results. Let's see what CI says. @bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit b1bf35a with merge 8cfe1e8001940dfc9d8f795bde769bb7615d8082... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 8cfe1e8001940dfc9d8f795bde769bb7615d8082 with parent cd1a46d, future comparison URL. |
Finished benchmarking try commit (8cfe1e8001940dfc9d8f795bde769bb7615d8082): comparison url. |
Is there a semantic difference between dummy and misc? We could try to unify the two instead. |
@@ -2124,7 +2124,7 @@ impl<'tcx> TraitObligationExt<'tcx> for TraitObligation<'tcx> { | |||
// by using -Z verbose or just a CLI argument. | |||
let derived_cause = DerivedObligationCause { | |||
parent_trait_ref: obligation.predicate.to_poly_trait_ref(), | |||
parent_code: Rc::new(obligation.cause.code.clone()), | |||
parent_code: Rc::new(obligation.cause.code().clone()), |
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.
parent_code: Rc::new(obligation.cause.code().clone()), | |
parent_code: obligation.cause.code(), |
And also change parent_code
to Option<Rc<ObligationCauseCode>>
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.
in general, all occurences of parent_code
currently reallocate
The perf results are mixed. |
When talking about an |
Ping from triage: There's a merge conflict now. |
This isn't going anywhere. |
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.
… r=Mark-Simulacrum Eliminate `ObligationCauseData` 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. r? `@ghost`
PR #72962 shrank
Obligation
at the cost of more heap allocations;overall it was a perf win.
This PR partly undoes that change, making
Obligation
a little bigger(though not as big as it was) while reducing the number of heap
allocations.
r? @ghost