Skip to content

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

Merged
merged 6 commits into from
Aug 10, 2023

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Aug 8, 2023

The benchmarks are noisy but show a 6% performance increase for coverage.

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a 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.)

@miss-islington
Copy link
Contributor

Thanks @markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 10, 2023
…events (pythonGH-107780)

(cherry picked from commit 37d8b90)

Co-authored-by: Mark Shannon <[email protected]>
@bedevere-bot
Copy link

GH-107841 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Aug 10, 2023
@markshannon markshannon deleted the tweak-ints-monitoring branch September 26, 2023 12:56
facebook-github-bot pushed a commit to facebook/fbthrift that referenced this pull request Apr 1, 2025
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
facebook-github-bot pushed a commit to facebook/hhvm that referenced this pull request Apr 1, 2025
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
Yhg1s pushed a commit that referenced this pull request Apr 6, 2025
… events (GH-107780) (#107841)

GH-107674: Avoid allocating boxed ints for `sys.settrace` line events (GH-107780)
(cherry picked from commit 37d8b90)

Co-authored-by: Mark Shannon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants