Skip to content
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

opt: improve handle_panic generated code #2074

merged 1 commit into from Dec 24, 2021


Copy link

I've been playing around with cargo llvm-lines a bit on the PyO3 codebase to find chunky functions which might want optimizing a bit for compile times.

pyo3::callback::handle_panic was an obvious target - it's called in every generated function and it ends up being one of the biggest single contributors to lib size.

Rearranging things a bit, and simplifying the Unsendable helper to remove the need for AssertUnwindSafe managed to cut the size of this function by about a third. (Renamed Unsendable to NotSend)

As a bonus, I think I made the NotSend error message nicer - see the UI test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant