Skip to content

Commit

Permalink
Enable full LTO on Python 3.12 and 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Feb 13, 2025
1 parent aa430e2 commit 4d43c13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
fi

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

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

0 comments on commit 4d43c13

Please sign in to comment.