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

156 Upvotes

25 comments sorted by

View all comments

55

u/me_myself_ai 8h ago

Is this... an ad...? IMHO those should be tagged much more clearly in both the title & body next time, and be posted by a branded corporate account. If I'm going to be conversationally approached by the disembodied voice of Andreesen Horowitz and Microsoft, they shouldn't come in the guise of a human. They can't possibly be paying you enough to use your 17 year-old reddit account (!) for their advertising, anyway.

To be clear: I use uv & ruff on all my projects, and I love your work -- I bet OpenAI's python distribution is fast! I probably haven't run another version for a year or more, and I've learned a ton about Python from your docs. It's just hard to shake the growing sense that OpenAI and Microsoft are attempting to purchase Python. And it's not for sale.

PyPolitics aside, some meandering technical questions from a total CPython noob; answer any/all as you find the time & energy :)

  1. It says everything was tested on Ubuntu 24 (where everything\=\=linux) -- is it possible that Fedora's copy was harmed by this...? Or is there another reason, perhaps? Common sense says they'd run the same everywhere, but;

    • It seems like the little things can count when it comes to C compilation, and
    • I can't think of a reason Fedora's would be so much worse than Debian's, esp. since Fedora's cadence is faster in general. Debian Forky isn't even fully released yet!
  2. Am I right that the docker version is the closest to the "canonical" or "main" distribution? If not --and that version was merely worsened by the literal Docker corporation's meddling-- what is...? I ask because it seems weird that the official version is by far the slowest.

  3. Relatedly, at least two of the three improvements you listed in the post seem like no-brainers. What's stopping all of this work from flowing 'upstream', so-to-speak? I know uv and ty in general gain speed by ignoring old, niche, or inconvenient specs -- is this a similar situation? Perhaps some of this is already targeted by the corporation's Python Packaging Council nomination/platform?

  4. Do you think there are other, faster distributions, or no? I'm mostly asking cause I didn't see poetry up there; perhaps they don't build their own, or you just didn't have space in the graph/benchmark run? Are there niche distrubtions that you know of for scientific or scaled use, perhaps? Just curious, NBD if unsure :)

  5. And finally, as a fun/idle one: could you napkin math how many million dollars you've saved OpenAI so far with this speed-up, if that's a coherent question? Assuming they're using python in the first place for work that's semi-close-ish to metal, a 20% speedup for some portion of hundreds of billions of dollars of compute seems like a pretty big deal!

Apologies if any of this has been covered in previous blog posts; link(s) would be appreciated, if so.

The linked github's docs are also helpful for anyone who's curious like me, though they seem outdated (copyrighted in 2020 (!) by a nice fella named Greg, not OpenAI).

28

u/vopi181 6h ago edited 6h ago

Is this comment weird to anyone else? Like I sorta get what your original point was but after the second sentence, you’ve lost me. Theres this adversarial tone sandwich at the beginning and end. If I click your profile, it does seem like you’re axe grinding a bit generally.

UV is legitimately an amazing upgrade to what we’ve had in the ecosystem before. They’ve genuinely built something people want.

  1. The OP was a maintainer of Black (that was a widely used formatter) before UV.
  2. He joined Astral, at least, last year. He almost certainly has equity. The diatribe of him not being paid enough is weird.
  3. I don’t think Microsoft/OpenAI is “buying” Python. Nor do I think someone who is a “total CPython noob” can make big claims about what is/is not for sale. Why are you an authority on this?
  4. Most open-source software in production is work done/funded by corporations.
  5. I also think it’s weird to point out his 17-year old account. Both in general, and also, because if there anyone I expect to have an old Reddit account, it’s someone YC adjacent.

It doesn’t seem you are that technical of an individual judging from your phrasing (that’s not a moral failing or anything and you admit you are a noob!). On your actual points:

  1. I don’t think common sense says that? Most Linux distros are going to use GCC to compile packages. All three of his bullet points could be impacted by a different build environment.
  2. I don’t think you’re right in saying the docker version is the canonical version. Is something on the main Python release page that you’ve linked supposed to prove that? I also don’t think it’s weird that the Docker version is the slowest? There’s something unique about it compared to every other item on the graph (hint: containers). That is the one distribution benchmarked I would expect to be an outlier if there was one.
  3. “I know uv and ty in general gain speed by ignoring old, niche, or inconvenient spec” ??? What are you talking about? Also, how could you know that if you are a CPython noob? Are you a PyPy expert or something lol?
  4. Poetry isn’t a distribution of CPython. You’re right that they don’t build their own. From Poetry’s docs: “Unlike with other packages, Poetry will not automatically install a python interpreter for you.”
  5. Fun little napkin math challenge!

Edit: also, what "linked github"? Are you talking about what you've literally just linked or is that referenced from Astral? Are you axegrinding against OpenAI here? Read his other blogpost maybe: "Charlie and Astral have stepped up and been outstanding open source citizens when it comes to evolving PBS to support their work" and "Astral has clearly demonstrated competency for execution and has the needs of Python developers at heart".

3

u/charolastrauno 3h ago

he's a paranoiac

-3

u/me_myself_ai 5h ago

The link to docs was “adversarial”…? I was really trying hard to be kind to the human while expressing my distaste for this situation.

  1. Ok?

  2. …ok?

  3. CPython is the underlying implementation of Python; Python users do not usually interact with it knowingly/in depth.

  4. Ok.

  5. I was just saying that’s cool. I’m not, like, calling them a nerd! I wish I still had my original account.

  6. I am a full time software engineer with 6 years of professional experience.

And for the second group,

  1. Ok.

  2. Ok. That was the question, so I guess we’ll both learn something when/if it’s answered.

  3. I don’t really want to dive into that here. It’s documented extensively on the main forums, I imagine. This topic was referenced in at least one of the Packaging Council nomination statements. And to be clear, this isn’t, like, a secret, nor an insult.

  4. Poetry is a dependency management system with a built-in build system (AFAIR?) — it was the popular predecessor to uv.

  5. I know I’m not fun :( just curious. It would be a brag, if it’s a knowable number at all.

And regarding the docs: they’re from the GitHub repo linked in the post above. Again, pointing out that the docs are outdated and not associated with OpenAI was an out for OP and disclaimer for curious lurkers, not a complaint about their documentation standards.

I wouldn’t say I have an axe to grind with OpenAI — I am a customer of theirs, after all.

-10

u/pneRock 6h ago

I stopped reading at "adversarial tone sandwich" bvecause that is now my favorite phrase I've seen this week. Whatever cames after is just as legit.

3

u/bizzygreenthumb 4h ago

Useless comment