Tech News
← Back to articles

Following Up on the Python JIT

read original related products more articles

Following up on the Python JIT

Please consider subscribing to LWN Subscriptions are the lifeblood of LWN.net. If you appreciate this content and would like to see more of it, your subscription will help to ensure that LWN continues to thrive. Please visit this page to join up and keep LWN on the net.

Performance of Python programs has been a major focus of development for the language over the last five years or so; the Faster CPython project has been a big part of that effort. One of its subprojects is to add an experimental just-in-time (JIT) compiler to the language; at last year's PyCon US, project member Brandt Bucher gave an introduction to the copy-and-patch JIT compiler. At PyCon US 2025, he followed that up with a talk on "What they don't tell you about building a JIT compiler for CPython" to describe some of the things he wishes he had known when he set out to work on that project. There was something of an elephant in the room, however, in that Microsoft dropped support for the project and laid off most of its Faster CPython team a few days before the talk.

Bucher only alluded to that event in the talk, and elsewhere has made it clear that he intends to continue working on the JIT compiler whatever the fallout. When he gave the talk back in May, he said that he had been working with Python for around eight years, as a core developer for six, part of the Microsoft CPython performance engineering team for four, and has been working on the JIT compiler for the last two years. While the team at Microsoft is often equated with the Faster CPython project, it is really just a part of it; " our team collaborates with lots of people outside of Microsoft ".

Faster CPython results

The project has seen some great results over the last few Python releases. Its work first appeared in 2022 as part of Python 3.11, which averaged 25% faster than 3.10, depending on the workload; " no need to change your code, you just upgrade Python and everything works ". In the years since, there have been further improvements: Python 3.12 was 4% faster than 3.11, and 3.13 improved by 7% over 3.12. Python 3.14, which is due in October, will be around 8% faster than its predecessor.

In aggregate, that means Python has gotten nearly 50% faster in less than four years, he said. Around 93% of the benchmarks that the project uses have improved their performance over that time; nearly half (46%) are more than 50% faster. 20% of the benchmarks are more than 100% faster. Those are not simply micro-benchmarks, the benchmarks represent real workloads; Pylint has gotten 100% faster, for example.

All of those increases have come without the JIT; they come from all of the other changes that the team has been working on, while " taking a kind of holistic approach to improving Python performance ". Those changes have a meaningful impact on performance and were done in such a way that the community can maintain them. " This is what happens when companies fund Python core development ", he said, " it's a really special thing ". On his slides, that was followed by the crying emoji 😢 accompanied by an uncomfortable laugh.

Moving on, he gave a "duck typing" example that he would refer to throughout the talk. It revolved around a duck simulator that would take an iterator of ducks and "quack" each one, then print the sound. As an additional feature, if a duck has an "echo" attribute that evaluates to true, it would double the sound:

def simulate_ducks(ducks): for duck in ducks: sound = duck.quack() if duck.echo: sound += sound print(sound)

... continue reading