pyo3 icon indicating copy to clipboard operation
pyo3 copied to clipboard

take control of exception object creation

Open davidhewitt opened this issue 1 year ago • 1 comments

The idea of this PR is to move exception creation out of the Python interpreter (where we can't control it, e.g. all the special cases in #4412), into our own code.

I think this would pave the way for optimisations and maybe relates to #4584 and #4413.

Having started on this, I think for 0.23 it's going to be simpler to just introduce some locking inside PyErr, however I would like to revisit this in the future as I think it will be a positive step. So for now I'm just pushing to see impact on benchmarks & tests, and so I don't forget it.

davidhewitt avatar Oct 30 '24 08:10 davidhewitt

CodSpeed Performance Report

Merging #4669 will degrade performances by 10.37%

Comparing davidhewitt:create-exception-objects (929056f) with main (f74d374)

Summary

❌ 1 regression
✅ 80 untouched

:warning: Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
err_new_restore_and_fetch 7.7 µs 8.6 µs -10.37%

codspeed-hq[bot] avatar Oct 30 '24 08:10 codspeed-hq[bot]