Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.5k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
* 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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
sergey-miryanov commentedOct 18, 2025
I'm not sure I get what android (x86_64) fails.
|
mhsmith commentedOct 19, 2025
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. |
Uh oh!
There was an error while loading.Please reload this page.
sergey-miryanov left a comment
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.
Code looks good to me, thanks!
sergey-miryanov commentedOct 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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). |
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Core_and_Builtins/2025-10-17-18-03-12.gh-issue-139951.IdwM2O.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
0c01090 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
* 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>
GH-140423 is a backport of this pull request to the3.14 branch. |
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).
Uh oh!
There was an error while loading.Please reload this page.
This PR:
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.