python icon indicating copy to clipboard operation
python copied to clipboard

[3.14] Enable the tail calling interpreter

Open jack-mcivor opened this issue 7 months ago • 1 comments

Can the 3.14 images enable the tail call interpreter? IIUC this brings a 5-6% free performance improvement https://docs.python.org/3.14/using/configure.html#cmdoption-with-tail-call-interp

jack-mcivor avatar Jun 18 '25 10:06 jack-mcivor

Our builds don't currently happen with Clang, and this doesn't appear to be supported with GCC (certainly not with the version we're building against).

For JIT (#1043, #947), we need Clang, but I'm not sure what the future of that is or whether that actually uses Clang for the entire build or just for the JIT functionality.

So before we can really consider this, we need to figure out how much work it'd be to switch to Clang, and what the downsides are.

Diff I was testing with:
diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template
index 8b3b8c8..1851ee6 100644
--- a/Dockerfile-linux.template
+++ b/Dockerfile-linux.template
@@ -175,6 +175,9 @@ RUN set -eux; \
        if is_alpine then "" else (
 -}}
                --enable-optimizations \
+{{ if rcVersion | IN("3.9", "3.10", "3.11", "3.12", "3.13") then "" else ( -}}
+               --with-tail-call-interp \
+{{ ) end -}}
 {{ ) end -}}
                --enable-option-checking=fatal \
                --enable-shared \

tianon avatar Jun 18 '25 16:06 tianon