-
-
Couldn't load subscription status.
- Fork 33.2k
GH-107674: Avoid allocating boxed ints for sys.settrace line events
#107780
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
GH-107674: Avoid allocating boxed ints for sys.settrace line events
#107780
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from a couple minor comments, LGTM.
(I'm approving, assuming you'll address the comments before merging.)
|
Thanks @markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
…events (pythonGH-107780) (cherry picked from commit 37d8b90) Co-authored-by: Mark Shannon <[email protected]>
|
GH-107841 is a backport of this pull request to the 3.12 branch. |
Summary: python/cpython#107674 slowdown in 3.12 settrace behavior this affects coverage python/cpython#127953 quadratic behavior for dictionaries. also possible python/cpython#107780 which has to do with boxing and unbox of python ints These fixes have not been merged into 3.12 trunk, for one the quadratic behavior fix doesn't patch cleanly. Enums are particularly painful because in thrift-py the .py contains two potentially large dict literals and a large class declaration. The problem was less pronounced in thrift-python because it doesn't have these large dicts and there seems to be some optimization for enums Removing just the dictionaries and leaving the class was not enough. Removing the large class was not enough. But building up the dictionaries and class at import time solves the problem. Reviewed By: itamaro Differential Revision: D72197140 fbshipit-source-id: 2c209bb12f232a0001570b77ec0e9fd28fcf4965
Summary: python/cpython#107674 slowdown in 3.12 settrace behavior this affects coverage python/cpython#127953 quadratic behavior for dictionaries. also possible python/cpython#107780 which has to do with boxing and unbox of python ints These fixes have not been merged into 3.12 trunk, for one the quadratic behavior fix doesn't patch cleanly. Enums are particularly painful because in thrift-py the .py contains two potentially large dict literals and a large class declaration. The problem was less pronounced in thrift-python because it doesn't have these large dicts and there seems to be some optimization for enums Removing just the dictionaries and leaving the class was not enough. Removing the large class was not enough. But building up the dictionaries and class at import time solves the problem. Reviewed By: itamaro Differential Revision: D72197140 fbshipit-source-id: 2c209bb12f232a0001570b77ec0e9fd28fcf4965
The benchmarks are noisy but show a 6% performance increase for coverage.