hack: try removing error normalization#4859
Conversation
CodSpeed Performance ReportMerging #4859 will degrade performances by 88.05%Comparing Summary
Benchmarks breakdown
|
|
Looks like (so far at least) the tests pass ok. The codspeed report suggests to me that:
|
|
The performance regressions seem to come from two cases:
I guess this also implies that we probably want to support a user-defined error type for |
That looks desirable to me, yes. I believe I have a branch somewhere that introduces |
|
Awesome that this is a significant net decrease in LOC and hopefully it's rare to create and then discard a PyErr in a non-error code path. Commenting to subscribe, but please feel free to ping me if you want my help with this. |
4d2bf73 to
31b7f09
Compare
|
Having rebased this, it's clear that this is still a pretty decent performance win across the codebase in general. With Encouraging proper Rust errors over Python exceptions seems like good design for most codebases except where the error is always going out to Python anyway (in which case the laziness was purely an overhead). The only question, IMO, is whether it's worth merging this to remove the behaviour from |
This is the most minimal diff I could write which removes the storage of "lazy" errors inside
PyErrand instead eagerly creates Python exceptions at the point ofPyErrcreation.Related to #4584
Now that I push this diff, I see that it's pretty obvious that what this change mainly leads to is that we need a
Python<'py>token to create aPyErr(in this PR I do it just internally withPython::with_gil, but maybe this links back to #4413 and we can do that at the same time).This is not ready to merge yet, I wanted to push it and see what happens in CI...