Top
Best
New

Posted by f311a 22 hours ago

Python's experimental JIT to be removed(lwn.net)
499 points | 275 commentspage 4
anthk 21 hours ago|
The Rust based Python3 port can keep it and it can still be far more secure than CPython. Not everything it's JIT'ted on RustPython, it's ondemand per function, you have to enable it explicitly.
incrudible 14 hours ago||
Python is a poor target for compilation, even the best JIT is never gonna make fundamental design flaws (that some may consider beloved features) disappear. It's never going to give "good" performance.

In my view, the right course of action is to specify an official strictly typed subset of the language with compilation and static analysis as the justification, then implement both JIT and AOT on top of that. Legacy code can be rewritten or thrown out in phases, C extensions can be ported.

Of course, any such proposal would invite monumental amounts of bikeshedding, which is why it wouldn't get far, much like the JIT proposal.

lioeters 13 hours ago||
> strictly typed subset of the language with compilation and static analysis

This is a great idea for popular dynamic languages with existing users and codebases, particularly the focus on "subset" to limit the scope and emphasizing that full backward compatibility is not a goal; and allowing for gradual, incremental adoption. That makes it a lot more practical to implement and adopt.

I think we'll see more of this. Recent examples include strictly typed TypeScript subset designed for ahead-of-time compilation.

tkcranny 14 hours ago||
That’s effectively what Mojo is. Hardly catching the world on fire but pretty good for what it does.
shevy-java 15 hours ago||
Python is no doubt a successful language. But, boy - this level of bureaucracy is annoying to no ends. Do people feel eager to propose a PEP? There are so many more enjoyable things to do in one's short life ...
kibwen 20 hours ago||
Assuming that the biggest bang-for-buck of JIT compilation is optimizing hot loops (which is also the biggest bang-for-buck of optimization in every other context as well), and assuming that, per the historical best practices, all hot loops in Python are already written in C (or Rust, these days), this outcome is somewhat what I would expect.
procaryote 20 hours ago|
The performance of python indicates otherwise. There are some performance critical libraries written in C or C++ but a lot of python is written in python.

Python in itself is poorly suited to ever become performant as it lacks the types required. I imagine that causes some issues for effective jit-ing too.

They had a chance to fix this when adding type annotations, but instead of making it "optional/gradual typing" they opted to make it "documentation or linting support", which is obviously the wrong choice, but there were cultural reasons

mahboi 10 hours ago||
Does optional/gradual typing even help with JIT?
procaryote 2 hours ago||
If you know the type you need fewer checks in the jitted code, and you can optimise to native types.

If it helps python specifically, given that the types themselves are pretty dynamic, who knows. A python integer doesn't map well to a native integer etc. Python really isn't designed for performance, and retrofitting it is hard.

pbronez 21 hours ago||
Interesting, makes sense. JIT in CPython main is a big deal, glad they’re proceeding with caution. Overall looks like they added it as an experimental feature for two years, then decided to back it out. Perfectly reasonable outcome.
samus 19 hours ago|
It looks like it very much should never have happened like this. The actually hard and awkward questions have not been asked beforehand, and the SC doesn't like their hands being forced, and rightly so.
henry700 7 hours ago||
bureaucracy and politics kills another innovation, fork found in kitchen
tonymet 17 hours ago||
what features would need to be removed to help python hit a baseline level of performance? adding typing? Some of the “functional” stuff. Is the performance a legacy issue or essential to the language’s design?
mahboi 10 hours ago|
From my limited understanding, the C interop is the biggest obstacle to both JIT and GIL. It's also the feature that makes Python fast enough for so many use cases. And the dynamic typing is the reason it even has to be JIT instead of just pre-compiled.
bbor 14 hours ago||

  To me, goals without plans behind them aren't really goals at all
Ok but that's not how specs and plans work -- they are very intentionally two distinct artifacts.

As usual, though, I might just be biased by default towards defending the Python aristocracy; they seem to pretty much always be on the right side of history, even in the little ways!

bratao 21 hours ago||
This is pretty bittersweet to see.

Python is my favorite language, but I'm honestly tired of having to rewrite performance bottlenecks in Cython or Rust all the time. When the Faster CPython project started with Microsoft's backing, I was really excited. Mark Shannon had that plan promising huge speedups across a few cycles, and while that clearly turned out to be much harder than anticipated, the team still kept pushing forward to deliver a real JIT.

Seeing all of that get bogged down in committee bureaucracy now is just frustrating.

I have a lot of respect for the core devs and I know maintaining CPython, and it is a time donation job. It isn't easy. But I feel that over-caution and red tape ends up discouraging serious contributions. They are setting an unreasonably high bar for something that would obviously help the entire ecosystem.

Just think about the sheer amount of electricity and compute power being wasted every single day running inefficient Python across millions of machines worldwide.

Python really deserves a proper JIT. I genuinely hope they reconsider this.

mananaysiempre 21 hours ago||
Unladen Swallow died for lack of upstream interest.

PyPy lacks upstream interest, looked like it could have a shot after many years of development but recently NumPy removed support because they just couldn’t fathom how a non-dead project could be a couple of versions behind CPython.

Now the new JIT is dying because of what seems to be a lack of upstream interest. (The things TFA describes as being required are not unreasonable, but not realistic for a necessarily speculative long-running project without wild amounts of committed funding.)

I’m not optimistic.

pansa2 20 hours ago||
> Unladen Swallow died for lack of upstream interest

IIRC Unladen Swallow was, despite the extreme hype, nothing more than the internship project of a couple of students. It died because their internship was over.

Otherwise you're right, though. Lots of CPython alternatives suffer from lack of upstream interest - the Python language designers don't seem very interested in anything other than CPython. In particular, they appear to only consider CPython when adding features to the language. Two examples:

- Requiring `dict`s to be ordered because that's how they work in CPython, without considering how they work in other implementations

- Adding pattern matching syntax that's suitable for CPython's PEG parser, even though it's not LL(1) so can't be parsed by, say, MicroPython

genxy 17 hours ago||
Core Python is antagonistic to all other Python implementations. There is only one Python.
pjmlp 19 hours ago|||
> Just think about the sheer amount of electricity and compute power being wasted every single day running inefficient Python across millions of machines worldwide.

Every single time I remember the first AI wave was done with Lisp and Prolog, both with tooling that supports machine code generation since about 50 years.

skeledrew 19 hours ago|||
> committee bureaucracy

That's what's kept the language and ecosystem improving and from becoming a hot mess. If something isn't properly specced then it really shouldn't be in prod. They allowed the experiment in the first place so it'd be easier to gather sufficient data to guide said speccing, but the ball was dropped by the proposers and so the experiment was an ultimate failure (unlike free threading) and prod is now being appropriately cleaned up.

samus 19 hours ago|||
It's not red tape, it's about making sure that the effort actually delivers what it promises and can continue to so in the future. From the state of the draft PEP it seems it doesn't and it won't ever. The SC merely put the nail into the coffin.
ZiiS 21 hours ago||
I know not everyone loves them; but `Claude rewrite the performance bottlenecks in Rust` works so well it is hard to see the security surface area and harder reason about performance as something that should be paid in core.
greenavocado 20 hours ago||
Done https://github.com/can1357/pon
ddorian43 20 hours ago||
Seems unmaintained from July.
greenavocado 15 hours ago||
I think its a meme but an interesting proof of concept nevertheless
videotextly 2 hours ago|
[flagged]
More comments...