Eliminate ObligationCauseData.#73983
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. |
| 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.
| 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.
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
Obligationat the cost of more heap allocations;overall it was a perf win.
This PR partly undoes that change, making
Obligationa little bigger(though not as big as it was) while reducing the number of heap
allocations.
r? @ghost