Live data from Hacker News

Python 3.13 Gets a JIT

tonybaloney.github.io

221–230 of 553 posts

Re: Python 3.13 Gets a JIT

#221
post #200

The last two-ish years have been insane for Python performance. Something clicked with the core team and they obviously made this a serious goal of theirs and the last few years have been incredible to see.

Microsoft are paying core devs to work on it full time, for one.

Re: Python 3.13 Gets a JIT

#222
post #6

I always wondered how Python can be one of the world's most popular languages without anyone (company) stepping up and make the runtime as fast as modern JavaScript runtimes.

A big part of what made Python so successful was how easy it was to extend with C modules. It turns out to be very hard to JIT Python without breaking these, and most people don’t want a Python that doesn’t support C extension modules. The JavaScript VMs often break their extensions APIs for speed, but their users are more used to this.

Which is why I'm shocked that Python's big "we're breaking backwards compatibility" release (Python 3) was mostly just for Unicode strings. It seems like the C API and the various __builtins__ introspection API thingies should've been the real focus on breaking backwards compatibility so that Python would have a better future for improvements like this.

Re: Python 3.13 Gets a JIT

#223
post #200

The last two-ish years have been insane for Python performance. Something clicked with the core team and they obviously made this a serious goal of theirs and the last few years have been incredible to see.

[deleted]

Re: Python 3.13 Gets a JIT

#224

Earlier quoted context omitted.

Also recall that a 50% speed improvement in SQLite was caused by 50-100 different optimisations that each eeked out 0.5-1% speedups. On phone now don’t have the ref but it all adds up.

That's true, and Rust compiler speed has seen similar speedups from lots of 1% improvements. But even if you can get a 2x improvement from lots of 1% improvements (if you work really really hard), you're never going to get a 10x improvement. Rust is never going to compile remotely as quickly as Go. Python is never going to be remotely as fast as Rust, C++, Go, Java, C#, Dart, etc.

Does it matter?

Trains are never going to beat jets in pure speed. But in certain scenarios, trains make a lot more sense to use than jets, and in those scenarios, it is usually preferable having a 150 mph train to a 75 mph train.

Looking at the world of railways, high-speed rail has attracted a lot more paying customers than legacy railways, even though it doesn't even try to achieve flight-like speeds.

Same with programming languages, I guess.

Re: Python 3.13 Gets a JIT

#225
post #26
post #6

I always wondered how Python can be one of the world's most popular languages without anyone (company) stepping up and make the runtime as fast as modern JavaScript runtimes.

anyone (company) stepping up and make the runtime as fast as modern JavaScript runtimes. There are a lot of faster python runtimes out there. Both Google and Instagram/Meta have done a lot of work on this, mostly to solve internal problems they've been having with python performance. Microsoft has also done work on parallel python. There's PyPy and Pythran and no doubt several others. However none of these attempts h…

Node.js and Python 3 came out at around the same time. Python had their chance to tell all the "mission critical legacy code" that it was time to make hard changes.

Re: Python 3.13 Gets a JIT

#226
post #199
post #154

Earlier quoted context omitted.

Rather those that don't know how to use the toolchains don't. JIT caches, AOT have been an option for years. And if you are really motivated, you can write stuff in C just like in Python.

You're naming things that need handling… which take time to be set up and so on.

I am naming things that need learning, pity that it is so big effort nowadays.

Re: Python 3.13 Gets a JIT

#227
post #65

Earlier quoted context omitted.

From the write-up, I honestly don't understand how this paves the way. I don't see an architectural path from a cut-and-paste JIT to something optimizing. That's the whole point of a cut-and-paste JIT.

It should be fairly easy to add instruction fusing, where they recognize often-used instruction pairs, combine their C code, and then let the compiler optimize the combined code. Combining LOAD_CONST with the instruction following it if that instruction pops the const from the stack seems an easy win, for example.

If it was that easy, you'd do that in the interpreter and proportionally reduce interpretation overhead.

Re: Python 3.13 Gets a JIT

#228
post #145

Earlier quoted context omitted.

Sure, for UNIX scripting, for everything else it is plainfully slow. I know Python since version 1.6, and is my scripting language in UNIX like environments, during my time at CERN, I was one of the CMT build infrastructure build engineer on the ATLAS team. It was never been the language I would reach for when not doing OS scripting, and usually when a GNU/Linux GUI application happens to be slow as mollasses, it has…

There's a lot of Django going on in the world. shrug . If we're talking personal experience, I've been using Python since 1.4. It's been my primary development language since the late 1990s, with of course speed critical portions in C or C++ when needed - and I know a lot of people who also primarily develop in Python. And there's a bunch of Python development at CERN for tasks other than OS scripting. ("The ease of…

> There's a lot of Django going on in the world.

Unfortunely.

> And there's a bunch of Python development at CERN for tasks other than OS scripting

Of course there is, CMT was a build tool, not OS scripting.

No need to give me CERN links to me to show me Python bindings to ROOT, or Jupyter notebooks.

> PyPy's experience shows we'll not be expecting a 5x boost any time soon from this new JIT framework, while C/C++/Fortran/Rust are significantly faster.

I really don't get the attitude that if it doesn't 100% fix all the world problems, then it isn't worth it.

Re: Python 3.13 Gets a JIT

#230
post #200

The last two-ish years have been insane for Python performance. Something clicked with the core team and they obviously made this a serious goal of theirs and the last few years have been incredible to see.

It’s because the total dollars of capitalized software deployed in the world using Python has absolutely exploded from AI stuff. Just like how the total dollars of business conducted on the web was a big driver of JS performance earlier.
Post reply on HN