On Wed, Dec 15, 2021 at 4:03 AM Victor Stinner <vstinner@python.org> wrote:
The last time I saw a benchmark on immortal object, it was clearly 10% slower overall on the pyperformance benchmark suite. That's a major slowdown.
Yes, I plan on benchmarking the change as soon as we can run pyperformance on main.
* abandon all hope
I wrote https://bugs.python.org/issue39511 and https://github.com/python/cpython/pull/18301 to have per-interpreter None, True and False singletons.
Yeah, I took a similar approach in the alternative to immortal objects that I prototyped.
By the way, I made the _Py_IDENTIFIER() API and _PyUnicode_FromId() compatible with subinterpreters in Python 3.10. This change caused a subtle regression when using subintepreters (because an optimization made on an assumption on interned strings which is no longer true). The fix is trivial but I didn't wrote it yet: https://bugs.python.org/issue46006
FYI, I'm looking into statically allocating (and initializing) all the string objects currently using _Py_IDENTIFIER(). -eric