gh-142531: Fix free-threaded GC performance regression#142562
Merged
nascheme merged 5 commits intopython:mainfrom Dec 11, 2025
Merged
gh-142531: Fix free-threaded GC performance regression#142562nascheme merged 5 commits intopython:mainfrom
nascheme merged 5 commits intopython:mainfrom
Conversation
If there are many untracked tuples, the GC will run too often, resulting in poor performance. The fix is to include untracked tuples in the "long lived" object count. The number of frozen objects is also now included since the free-threaded GC must scan those too.
Subtract the objects that are unreachable and add back the ones that are resurrected. This likely doesn't matter in most cases but if the GC is freeing a lot of cyclic garbage then we don't want to over count the long lived objects.
|
🤖 New build scheduled with the buildbot fleet by @nascheme for commit e60bc49 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142562%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
Thanks @nascheme for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Sorry, @nascheme, I could not cleanly backport this to |
|
Thank you so much for addressing this within 24 hours of reporting this, that is amazing! Do you also plan to backport this to 3.14 or will this ship in 3.15? |
nascheme
added a commit
to nascheme/cpython
that referenced
this pull request
Dec 12, 2025
…ythongh-142562) If there are many untracked tuples, the GC will run too often, resulting in poor performance. The fix is to include untracked tuples in the "long lived" object count. The number of frozen objects is also now included since the free-threaded GC must scan those too. (cherry picked from commit e38967e)
|
GH-142617 is a backport of this pull request to the 3.14 branch. |
fatelei
pushed a commit
to fatelei/cpython
that referenced
this pull request
Dec 12, 2025
…h-142562) If there are many untracked tuples, the GC will run too often, resulting in poor performance. The fix is to include untracked tuples in the "long lived" object count. The number of frozen objects is also now included since the free-threaded GC must scan those too.
nascheme
added a commit
that referenced
this pull request
Dec 12, 2025
) (gh-142617) If there are many untracked tuples, the GC will run too often, resulting in poor performance. The fix is to include untracked tuples in the "long lived" object count. The number of frozen objects is also now included since the free-threaded GC must scan those too. (cherry picked from commit e38967e)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If there are many untracked tuples, the GC will run too often, resulting in poor performance. The fix is to include untracked tuples in the "long lived" object count. The number of frozen objects is also now included since the free-threaded GC must scan those too.