-
Notifications
You must be signed in to change notification settings - Fork 782
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
Noticeable performance downgrade from Python 3.10 to onwards versions #4716
Comments
Thanks for the questions. I don't have an immediate answer for you; to check I understand, Python 3.11 and up got ~30% slower? Have you tried generating flame graphs (e.g. with |
@davidhewitt correct, here is a more direct comparison extracted from that bench:
that makes sense. Let me plan some tests using sampling, I'll post here the findings. |
@davidhewitt I tried using samply as you suggested to build flame graphs, but even with the following profile used in build [profile.profiling]
inherits = "release"
debug = true the stacks in the report just shows items as 0x12989b _granian.cpython-310-x86_64-linux-gnu.so, so it's quite hard to spot on differences between 3.10 and 3.11 builds. Do you have any further suggestions on how to get full stacks on a PyO3 |
Btw, I re-run tests with PyO3 0.23 and they show the same issue (ignore the absolute numbers vs last table as it's different hardware):
Might this be related to threads? The involved code has the main Python thread waiting on a |
Hi 👋 I'm not sure wether this makes sense as an issue or should be a discussion instead: to project maintainers, feel free to move this to a discussion if you conclude that's better.
Context: in the Granian project (an HTTP server) we recently introduced some e2e benchmarks using different Python versions, which show a ~30% performance degradation for some tests when comparing Python 3.10 to all other versions onwards (PyO3 0.22, cfg
pyo3_disable_reference_pool
).Now, the specific tests showing this degradation involves some relatively simple code:
pyclass
and aPyDict
objects (https://github.com/emmett-framework/granian/blob/c94e73e32a4865a011a4b659ef04bbc0a96e6fd4/src/wsgi/callbacks.rs#L24-L106)pyclass
object (https://github.com/emmett-framework/granian/blob/c94e73e32a4865a011a4b659ef04bbc0a96e6fd4/src/wsgi/io.rs#L49-L57)While I understand an e2e benchmark might suffer from a lot of additional noise when compared to a smaller unit-benchmark, and there's a lot more to consider (network stack in CPython stdlib, for example), I also believe, given other protocols involving asyncio and a bunch more stuff suffer from a very smaller degradation compared to the one I referenced, there might be something going on in PyO3 <-> CPython interop. Thus I have two main questions:
Thanks in advance 🙏
The text was updated successfully, but these errors were encountered: