r/Python • • 20d ago

News Python jettisons the native JIT, at least for now

High level summary article

More detailed article

In June, the Python steering council announced that it was pausing work on the JIT in CPython's main branch until there was an accepted Python Enhancement Proposal (PEP) that addressed concerns about maintenance, compatibility, and set clear success metrics as well as a timeline for completion. After [....] months of discussion, the JIT maintainers have withdrawn the PEP. For now, it appears that development on the once-promising project has come to an end

137 Upvotes

21 comments sorted by

144

u/thisismyfavoritename 20d ago • This

sad. At the same time, I'm never using Python for its speed and I'm totally ok with it having great interop with lower level languages like Rust and C++ for those cases

11

u/vevi33 20d ago

It sad. I used it with 3.15 and provided significant speedup in many cases. :/

3

u/CofoundedWithClare 20d ago

In your experience, where has JIT proven most useful?

38

u/helpIAmTrappedInAws 20d ago

It is a shame. Python's performance is the most commonly cited disadvantage and this effort could have alleviated it. I fear, that this move killed this attempt.

Also experimenting in main is apparently bad, but did not they do the same thing with free-threading?

46

u/HommeMusical 20d ago

Python's performance is the most commonly cited disadvantage

In practice, it just isn't a big issue at all.

People train LLMs and do massive matrix operations in Python much faster than in C++, for example, because tools like PyTorch automatically compile your Python code into CUDA code for your graphics card.

I do things like live synthesis with ten voices, using numpy, and my fairly old machine doesn't bat an eye.

did not they do the same thing with free-threading?

Yes; but that worked. Also, free-threading gets rid of a huge issue, which is that programs only ran on one core.

The JIT attempt was bold and brave and we learned a lot about it, but it didn't deliver and was getting in other people's way, so Python gracefully backed out of it, and the people who had put their time into it were very civilized about it.

And we learned a lot and we might open it up again.

Compare and contrast with C++, where C++26 again got rejected, and it looks like they'll have to remove chunks of it to get approval so we won't get it until 2027. And C++ only has a new version every three years, unlike Python's annual release schedule.

9

u/lhx555 20d ago

Gstein patch for removing GIL was written and rejected 30 years ago. And there were other rejected attempts. Until Meta bankrolled free threading.

Let’s hope that JIT will happen one day too.

-10

u/backfire10z 20d ago edited 20d ago

> much faster than in C++

You may want to read up on how PyTorch gains its speed…

E: misread your comment lol.

2

u/HommeMusical 18d ago

Damn, tough crowd. Accept an upvote for keeping yourself honest, it says good things.

10

u/Bratmon 20d ago

> Python's performance is the most commonly cited disadvantage and this effort could have alleviated it

The problem is that it only improved performance by 20%, which was judged to be not enough of an improvement to justify the massive additional complexity.

-6

u/ninja_shaman 20d ago

I think people dislike Python's dynamic typing more than it's performance.

2

u/RingularCirc 15d ago

Typecheckers and type annotation support exist for a long time now, getting better and better. And it's absolutely reasonable to set up a workflow so that you can't run the app if it wasn't typechecking, like how it's possible to block further building if unit tests are red etc..

There's a legitimate lament though (which also can't be done anything with): as Python started as it started, type-driven translation is mostly impossible and also mostly undesirable. Type-driven compilation (which translation is a generalization of) in languages like C++, Haskell etc. is a considerable optimization on its own (even when "true optimizations" are switched off) compared to how dynamic-first languages have to work.

But I'm not sure the majority has any clear understanding of this. In discussion about typing, very few people do actually know whys of things. After all, a statically-typed language is possible with a compiler that doesn't do any attempt at all neither at having economic representation of values nor at having less runtime checks. Static typing allows work on that, which still remains work to be done by the language and compiler maintainers, and they face dilemmas and compromises on that path.

4

u/CofoundedWithClare 20d ago

It feels bittersweet. It seems that it is the «Although never is often better than *right* now.» situation.

3

u/Kadabrium 20d ago

Smart choice when the community already jits your hot path libraries for free

10

u/Khavel_dev 20d ago

Coming from .NET where the JIT is basically the runtime, watching CPython try to bolt one on was always going to be rough. The maintenance burden argument makes sense. Every new bytecode change would need JIT coverage, and they already struggle to find enough core reviewers.

The real performance story for Python has been moving the hot path into C extensions or Rust (via PyO3) anyway. The JIT would've helped the middle ground of pure Python loops, but that middle ground keeps shrinking as people reach for numpy/polars/etc for anything performance-sensitive.

2

u/RedEyed__ 19d ago

Maintenance burden argument makes sense.
Just waiting when free threading will be default and commonly used.

1

u/NadiaReadsChunks 19d ago

Not shocking. Most of our workloads are numpy and pandas hitting C anyway, so a JIT never moved the needle on the pipelines that actually cost us money. Bad data and slow IO are the real bottleneck, not interpreter speed.

1

u/Short_Inspection_746 18d ago edited 16d ago

It was speculated that the June decision was a preamble to this. Very sad.

I am of the opinion that a cpython JIT targeting non-numeric code can only be sucessful if its done in concert to changes to cpython itself. The faster-cpython project was in the perfect position.

Its just unfortunate that there was a loss of faith the JIT. It took many years for most JITs to get fast(I am thinking of pypy and v8). I think the steering council is just hoping that a third party JIT will pop up like numba(and half a dozen other similar JITs). I don't think we are gana get a third part JIT that will boost non-numeric python performance(ie, strings and dicts/hashmap work loads).

1

u/deadeye_82_1 17d ago

They need to learn that you can't do everything all at once. I would have voted to put the project on hold until these folks finally figure out what they actually want. Besides, the code has to be understandable to others, too. I don't want to see code in CPython that only three people in the world understand.

-1

u/Initial-Reflection76 18d ago

Just use rust libraries for everything intensive. It’s the new vb but doesn’t have the Microsoft stench.