python: 3.14: build with clang, lld, ThinLTO and tail-call interpreter#365
python: 3.14: build with clang, lld, ThinLTO and tail-call interpreter#365bdraco wants to merge 2 commits into
Conversation
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.
There was a problem hiding this comment.
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.
|
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 |
|
home-assistant/core#171760 is the CI switch to the faster interpreter showing the improvement is more than 10% in some cases |
Nice! I see those builds also use mimalloc. I remember suggesting mimalloc to replace jemalloc at one point, but for some reason we did not follow through with it. Just recently Facebook resurected jemalloc, but maybe its anyways better to use mimalloc? 🤔 |
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/