Skip to content

Commit 4d43c13

Browse files
committed
Enable full LTO on Python 3.12 and 3.13
1 parent aa430e2 commit 4d43c13

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cpython-unix/build-cpython.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,11 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
427427
fi
428428

429429
if [ -n "${CPYTHON_LTO}" ]; then
430-
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-lto"
430+
# On Python 3.12 and 3.13, `--with-lto` enables ThinLTO by default, while on other versions it
431+
# enables full LTO. We prefer runtime performance over build time, so force full on all
432+
# versions.
433+
# See https://docs.python.org/3.14/using/configure.html#cmdoption-with-lto
434+
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-lto=full"
431435
fi
432436

433437
# Python 3.11 introduces a --with-build-python to denote the host Python.

0 commit comments

Comments
 (0)