Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-139951: Fix major GC performance regression#140262

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
markshannon merged 6 commits intopython:mainfromfaster-cpython:dont-track-tuples
Oct 21, 2025

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commentedOct 17, 2025
edited by bedevere-appbot
Loading

This PR:

  • Counts number of actually tracked objects, instead of trackable objects. This ensures that untracking tuples has the desired effect of reducing GC overhead
  • Does not track most untrackable tuples during creation. This prevents large numbers of small tuples causing excessive GCs.

For theexample in the original report this makes performance on main a bit better than 3.13.

Benchmarking results show this is about neutral on performance otherwise.

* Count number of actually tracked objects, instead of trackable objects. This ensures that untracking tuples has the desired effect of reducing GC overhead* Do not track most untrackable tuples during creation. This prevents large numbers of small tuples causing execessive GCs.
@sergey-miryanov
Copy link
Contributor

I'm not sure I get what android (x86_64) fails.
I can propose two solutions:

  1. Change default value forwork_to_do from-5000 to0
  2. Or remove newly added condition
if (gcstate->work_to_do < 0) {    return;}

@mhsmith
Copy link
Member

I'm not at all familiar with the garbage collector, but one of the ways that Android differs from the other platforms is that it runs all the test suite serially in a single process.

sergey-miryanov reacted with thumbs up emoji

Copy link
Contributor

@sergey-miryanovsergey-miryanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Code looks good to me, thanks!

@sergey-miryanov
Copy link
Contributor

sergey-miryanov commentedOct 21, 2025
edited
Loading

Should we redo the benchmarks to see how the final version impacts performance? Maybe we can run it onhttps://github.com/faster-cpython/benchmarking-public (but I don't know how).

@markshannonmarkshannon merged commit0c01090 intopython:mainOct 21, 2025
45 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 21, 2025
* Count number of actually tracked objects, instead of trackable objects. This ensures that untracking tuples has the desired effect of reducing GC overhead* Do not track most untrackable tuples during creation. This prevents large numbers of small tuples causing execessive GCs.(cherry picked from commit0c01090)Co-authored-by: Mark Shannon <mark@hotpy.org>
@bedevere-app
Copy link

GH-140423 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelOct 21, 2025
markshannon added a commit that referenced this pull requestOct 23, 2025
…-140262 (GH-140447)* Count number of actually tracked objects, instead of trackable objects. This ensures that untracking tuples has the desired effect of reducing GC overhead* Do not track most untrackable tuples during creation. This prevents large numbers of small tuples causing execessive GCs.
nascheme added a commit to nascheme/cpython that referenced this pull requestNov 27, 2025
This reverts parts of thepythonGH-140262 change.  The changes that affect thetuple untracking are left unchanged.  Revert the changes to thecalculation of the increment size, based on the "work_to_do" variable.This causes cyclic garbage to be collected more quickly.  Revert alsothe change to test_gc.py, which was done because the expected GCcollection was taking longer to happen.With the tuple untrack change, the performance regression as reported bybugpythonGH-139951 is still resolved (work_to_do changes are not required).
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@sergey-miryanovsergey-miryanovsergey-miryanov approved these changes

@eendebakpteendebakpteendebakpt left review comments

@efimov-mikhailefimov-mikhailefimov-mikhail approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@markshannon@sergey-miryanov@mhsmith@eendebakpt@efimov-mikhail

[8]ページ先頭

©2009-2025 Movatter.jp