r/Python • u/nicholashairs • 27d ago
News Python jettisons the native JIT, at least for now
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
38
u/helpIAmTrappedInAws 27d 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 27d 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
-10
u/backfire10z 27d ago edited 27d 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 25d ago
Damn, tough crowd. Accept an upvote for keeping yourself honest, it says good things.
10
-6
u/ninja_shaman 27d ago
I think people dislike Python's dynamic typing more than it's performance.
2
u/RingularCirc 21d 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 26d ago
It feels bittersweet. It seems that it is the «Although never is often better than *right* now.» situation.
3
10
u/Khavel_dev 27d 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__ 25d ago
Maintenance burden argument makes sense.
Just waiting when free threading will be default and commonly used.
1
u/NadiaReadsChunks 25d 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 25d ago edited 23d 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 23d 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 24d ago
Just use rust libraries for everything intensive. It’s the new vb but doesn’t have the Microsoft stench.
145
u/thisismyfavoritename 27d ago •
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