mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-128691: Use deferred reference counting on _thread._local
(#128693)
This change, along with the LOAD_ATTR specializations, makes the "thread_local_read" micro benchmark in Tools/ftscalingbench/ftscalingbench.py scale well to multiple threads.
This commit is contained in:
parent
087bb48aca
commit
c1417487e9
1 changed files with 4 additions and 0 deletions
|
@ -1414,6 +1414,10 @@ local_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// gh-128691: Use deferred reference counting for thread-locals to avoid
|
||||
// contention on the shared object.
|
||||
_PyObject_SetDeferredRefcount((PyObject *)self);
|
||||
|
||||
self->args = Py_XNewRef(args);
|
||||
self->kw = Py_XNewRef(kw);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue