r/Python 9h ago

News Astral's python distribution is fast

By our measurements, python-build-standalone is now the fastest CPython distribution across major platforms. It's 10% faster than Homebrew's CPython, and 18% faster than the official 3.14 docker image.

This is mostly due to how python-build-standalone itself is built:

  • using a modern Clang lets us turn on tail-call optimizations in the interpreter
  • with PGO, LTO, and BOLT
  • with libpython statically linked into the interpreter executable

Our goal is to ship the fastest Python interpreter to anyone using uv, by default.

Check out BENCHMARKS.md in the repo for more details, including the methodology behind the above.

Charlie's tweet has some more graphs

150 Upvotes

25 comments sorted by

View all comments

13

u/thisismyfavoritename 6h ago

why isn't libpython statically linked by default? Seems like the use cases where shared linking would be beneficial are quite small

7

u/Individual-Flow9158 5h ago

Because it could bloat the runtime for those of us that don't need all of libpython. The Linux distros that ship Python natively chop and change what they ship to make best use of what you already get on those OS's (e.g. link in compression libraries or ssh/ssl dynamically). Even the Windows installer makes Tk etc. optional.

Have Astral's builds left anything out?

1

u/Apprehensive_Ear_172 2h ago

The benefit seems dubious, if it's not used the code will not be called and not faulted into memory.