Skip to content

python: 3.14: build with clang, lld, ThinLTO and tail-call interpreter#365

Open
bdraco wants to merge 2 commits into
masterfrom
python-3.14-clang-tail-call
Open

python: 3.14: build with clang, lld, ThinLTO and tail-call interpreter#365
bdraco wants to merge 2 commits into
masterfrom
python-3.14-clang-tail-call

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented May 19, 2026

I've been meaning to do this for a while because I see all the profiles and uv's python is noticeably faster, but I keep forgeting, but today I finally had some cycles to do it.

Its nearly a 10% free speed up for most cases https://lwn.net/Articles/1010905/

Switches the 3.14 image to clang with lld and ThinLTO, and enables the
tail call interpreter; this matches what python build standalone ships
with astral-sh/setup-uv and is roughly 10% faster than the current GCC
build.

Only 3.14 is touched; 3.12 and 3.13 stay on GCC since we only keep them
for back compat.
PGO instrumentation links against libclang_rt.profile.a which ships in
Alpine's compiler-rt package; add it to build-deps.
@bdraco bdraco requested a review from Copilot May 19, 2026 19:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Python 3.14 image build to use an LLVM-based toolchain and newer CPython build/configure options aimed at improving runtime performance.

Changes:

  • Add LLVM toolchain packages (clang/llvm/lld/compiler-rt) to the Python 3.14 build dependencies.
  • Switch CPython build to ThinLTO (--with-lto=thin) and enable the tail-call interpreter (--with-tail-call-interp).
  • Use clang as the compiler and lld as the linker for the build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bdraco bdraco marked this pull request as ready for review May 19, 2026 19:32
@bdraco
Copy link
Copy Markdown
Member Author

bdraco commented May 19, 2026

While this works locally for me and obviously is widely deployed via uv, it should still get a nightly HA build before shipping just to be sure

@agners agners closed this May 19, 2026
@agners agners reopened this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants