-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Optimize _PyObject_IS_GC in free-threaded build #114733
Copy link
Copy link
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Description
Activity
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Feature or enhancement
@nascheme writes the following suggestion (from #114564 (comment)):
I think this might require a bit of refactoring, but worth doing eventually. At a glance:
_PyObject_GC_New()(and related functions) could initializeob_gc_bitswith the "IS GC" setPyType_GenericAlloc()would also need to initializeob_gc_bitswith the "IS GC" set if the type is a GC type._Py_NewReference()requires some care. It. currently initializesob_gc_bitsto zero and it's used after "allocating" objects from freelists.Linked PRs