Hacker News new | ask | show | jobs
by nigma1337 1334 days ago
Planned for 3.12

> Simple "JIT" compiler for small regions. Compile small regions of specialized code, using a relatively simple, fast compiler.

https://github.com/markshannon/faster-cpython/blob/master/pl...

1 comments

I guess better than nothing then.
When you're dealing with one of the most popular languages in the world and the cost of getting it wrong and breaking things is astronomical, being risk adverse and starting small seems like the way to go.
Doesn't seem to hinder JavaScript runtimes.
Hasn't Microsoft experimented with disabling the JIT for security reasons?[1] Doesn't have much relevance for Python at the moment, but I'm just mentioning it to underline that a modern JIT can be very complex thing and keeping it simple for 3.11 seems like a very reasonable requirement.

[1] Random google result as source: https://www.cyclonis.com/microsoft-edge-tests-disabling-java...

That isn't what is being discussed here, every JIT has a potential for eventually generating code patterns susceptible of exploits.
JavaScript has multiple companies with valuations measured in billions of USD competing. Optimizing JavaScript is just as hard but they can throw massive development teams at the problem. Python isn’t without resources but the level of scale is dramatically different.
> JavaScript has multiple companies with valuations measured in billions of USD competing.

A couple of them have valuations in the trillions of USD, actually.

Yeah, I thought about that when I was writing that but didn’t want to get into debates about what fraction of those resources they put into web stuff. Even if you ignore the big ones however, Mozilla is just web stuff and they’re still much bigger than the core Python team.

(Mozilla does support a ton of OSS, too, so read that as everyone else needing to step up rather than an attack on them)

Because those investing into machine learning frameworks in Python rather spend their resources rewriting their libraries in C, C++ and Fortran while calling it "Python".
Python's ease of calling C libraries is both the blessing and a curse.

My opinion is that it's mostly a curse, since you are hampering the language's evolution and growth for a mere temporary benefit.

Not to mention the horror of distributing compiled libraries, which is one of the biggest reasons why packaging in Python is still such a nightmare.

Making CPython faster by getting rid of the GIL will do wonders for this language and it's community. It will make it much more portable, too. Think of Java-level portability, but in a much nicer package.

Sure, my point was just that the number of corporate investment in the core Python language is smaller. Investing in an ML framework isn’t a bad thing but it doesn’t support anyone working on the core language the way Google, Apple, Microsoft, Samsung, etc. contribute directly to Chromium/WebKit development.
JavaScript doesn’t have a C API, that makes all the difference
what about NAPI? Or deno/buns JITed api?

I’ve heard this “no C API” thing echoed by a couple people and it’s baffling. Do folks really think three major JS engines all written in C++ wouldn’t have an interface to interact with C?

The problem is evolving the interpreter in a way that doesn't break bazillions of third party bindings -- Win32, OpenGL, Fortran for NumPy/Pandas, databases, GPUs, every C and C++ library ever, etc.

Python's C API exposes ref counting and the GIL. It's also very large

JS doesn't have that problem -- more code is written in pure JS, there are no C/C++ bindings in the browser.

There are C/C++ bindings in node.js for v8, but as far as I know they are discouraged and not used very much. The bindings are more "first party" in node.js than third party.

They have issues, but not the same ones as CPython, because the API is very different

JS VMs must be re-entrant because they're embedded in browsers. That was never the case for CPython

The only C code JavaScript needs to interact with is 100% under the control of the browser implementing that JavaScript engine.

JavaScript doesn't interact with random C libraries that the user might have, like Python does.