add second lifetime to PyRef and PyRefMut#4720
Conversation
04fadee to
b3ca8c0
Compare
|
Thank you for making progress on this one. There's a measurable perf boost in the ordering operator benchmarks and I guess similarly this is a win for most Again the same thing that's paining me as in #4390 is I'm trying to think hard how we keep the API easy for users. Lifetimes scare Rust newbies enough, let alone two 😂 Are there any tricks we can play which avoid the complexity for the common case? Here's two I can think of:
(Given that we're wanting to revisit pyclass borrow checking and locking anyway, maybe we could add new types Opinions welcome to which, if any, of these ideas are not crazy 😂 |
|
Thanks for your thoughts!
That's certainly true. I agree that introducing The second option sounds very interesting. Switching the lifetime and introducing it via |
CodSpeed Performance ReportMerging #4720 will not alter performanceComparing 🎉 Hooray!
|
2367016 to
1f82315
Compare
6e1fa4b to
a025fca
Compare
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
I feel like I wrote a reply to this ages ago, but it doesn't look like it's here, so probably it got interrupted by family (sorry both for that and the long long lag to actually reply here). I think the difference in ... but maybe if we accept two traits, the second trait becomes |
|
As for this here, it seems then that the migration path we quite like here is to add new We can probably introduce those already and implement |
As a final thought, I still have a vague hope that in the long run we might be able to make the Rust compiler use the unicorn feature "contexts" to make |
No worries 😄 This is kind of a big change with lots of paths that we can take. So I expected it to take time to figure out the design.
I started an experiment with those in #5233. Looks promising, I'll continue playing with it. |
|
Shall we close this in favour of #5233 ? |
|
I think so, yes. |
Companion to #4390