[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)
STINNER Victor
report at bugs.python.org
Fri Jan 31 19:30:57 EST 2020
STINNER Victor <vstinner at python.org> added the comment:
> Would it not suffice to just make the singletons "immortal"?
The problem is to make Py_INCREF/Py_DECREF efficient. Last time someone tried to use an atomic variable for ob_refcnt, it was 20% slower if I recall correctly. If many threads start to update such atomic variable, the CPU cacheline of common singletons like None, True and False can quickly become a performance bottleneck.
On the other side, if each interpreter has its own objects, there is no need to protect ob_refcnt, the interpreter lock protects it.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39511>
_______________________________________
More information about the Python-bugs-list
mailing list