[3.14] GH-139951: Fix major GC performance regression (GH-140262)#140423
Closed
miss-islington wants to merge 1 commit intopython:3.14from
Closed
[3.14] GH-139951: Fix major GC performance regression (GH-140262)#140423miss-islington wants to merge 1 commit intopython:3.14from
miss-islington wants to merge 1 commit intopython:3.14from
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. (cherry picked from commit 0c01090) Co-authored-by: Mark Shannon <mark@hotpy.org>
Contributor
|
The following change fixes free-threading tests (mainly diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index db643330894..d7a4c066437 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -3,8 +3,7 @@
from test import support
from test.support import (verbose, refcount_test,
cpython_only, requires_subprocess,
- requires_gil_enabled,
- Py_GIL_DISABLED)
+ requires_gil_enabled)
from test.support.import_helper import import_module
from test.support.os_helper import temp_dir, TESTFN, unlink
from test.support.script_helper import assert_python_ok, make_script, run_test_script
@@ -1386,10 +1385,6 @@ def callback(ignored):
junk = []
i = 0
detector = GC_Detector()
- if Py_GIL_DISABLED:
- # The free-threaded build doesn't have multiple generations, so
- # just trigger a GC manually.
- gc.collect()
assert not detector.gc_happened
while not detector.gc_happened:
i += 1
@@ -1459,10 +1454,6 @@ def __del__(self):
detector = GC_Detector()
junk = []
i = 0
- if Py_GIL_DISABLED:
- # The free-threaded build doesn't have multiple generations, so
- # just trigger a GC manually.
- gc.collect()
while not detector.gc_happened:
i += 1
if i > 50000:Is it fine if I add such commit to this PR? Should we apply this change to the |
Member
|
Сс @colesbury |
Contributor
|
The test has a |
Member
|
Closing in favor of #140447 |
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.
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 commit 0c01090)
Co-authored-by: Mark Shannon mark@hotpy.org