The PyPy team writes about its alternative Python implementation, covering JIT performance, compatibility, transactional memory, and fundraising.
HN links it for project updates and donations, and commenters note the project is struggling and ask for benchmarks against newer CPython versions.
Yeah, I've done some useful things with pygame. My game business almost entirely uses Unity, but I do find that Python is helpful for tool development as, like you, I know the language well. Often it's a lot speedier to write a quick visual tool in Python that generates a bunch of json data that gets loaded in as a text asset and parsed, than it is to write the same thing as an editor plugin (at least for me!) Using Python + pygame or Python + PySDL2[0] gets you rendering stuff on the screen and receiving input, fast.
I've also used the Twisted Matrix[1] for some online TCP-based game server work, and that was pretty positive, though the library is quite daunting to figure out. That was 8 years ago though, perhaps there are better libraries nowadays.
Writing an entire game in Python might be an uphill struggle though. The interpreter is really slow, so a JIT alternative like Pypy[2] is very necessary. On my game server project I remember having to use a combination of Pypy and writing the tightest inner-most parts of my simulation loop in Cython to get the server tick to the target. As much as I love Python, if you're comfortable with Godot, it's probably a better long term investment with fewer headaches along the way.
[0] - https://pypi.org/project/PySDL2/
[1] - https://twistedmatrix.com/trac/
[2] - https://www.pypy.org/
It is possible to JIT compile Python just fine. There are projects like PyPy that have been doing this for a long time [1]. The reason these alternative projects never take off is because many of Python's most used libraries are written against CPython's C API. This API is giant, and exposes all of the nitty gritty implementation details of the CPython interpreter. As a result, changing anything significant about the implementation of the interpreter means those libraries no longer work. In order to not break compatibility with the enormous amounts of packages the internals of the CPython interpreter are mostly locked in at this point with little wiggle room for large performance improvements.
The only real way out is to make Python 4 - but given the immense pain of the Python 2 -> 3 transition that seems unlikely.
[1] https://www.pypy.org
Judging by the example of Babashka, Graal apparently does give you a "huge opaque runtime", and also there seem to be severe limitations on loading code. I think it basically has to include all the Clojure code up front, which makes it arguably NOT interactive.
RPython and PyPy are great engineering and great projects, but I think RPython has not quite "escaped" into the real of general purpose language implementation -
https://www.pypy.org/posts/2018/09/the-first-15-years-of-pypy-3412615975376972020.html
I think it taught a lot of valuable lessons in this space, but it's not really an answer to the stated problem.
I'm personally very excited about the prospects for NumPy in PyPy, as this is my main use case for python.
Relatedly, on the PyPy homepage, you can give money to help grease the wheels on development of specific PyPy features: http://pypy.org/. There's also quite detailed proposals that describe where the money will go, how it will help each feature's development, why each feature is useful/cool, etc. To me this seems like a really awesome way to organize donations for an open source project and gives me greater confidence that my donation will have an impact.
Python does, via pypy [1], which has very impressive performance and Python3 support. However, there are some subtle drawbacks, e.g., building from source takes hours instead of seconds (like CPython), and C extensions are slower. Still, the performance of pypy on a wide range of pure Python microbenchmarks is extremely impressive, and comparable to V8 (I've been collecting such benchmarks at [2] lately).
[1] https://www.pypy.org/
[2] https://github.com/sagemathinc/JSage/tree/main/packages/jpython/bench
> What I personally really want is faster Python/Ruby
By the way, have you tried PyPy?
It's an alternative Python interpreter with a JIT (so compiling in-memory to native code) that is much faster than the standard CPython for many Python tasks, especially those that are particularly compute-bound.
https://www.pypy.org/
I was impressed at how fast some math-oriented Python programs that I wrote ran in PyPy. There are some extensive technical limitations, but it works out-of-the-box for many codebases.