229 points · by yla92 · 3y ago · 136 comments
But if they interface with external libraries then some extra steps may be needed.
Not to take away from the excitement. I love Rust and cargo is great.
It can be more involved, it can be less involved.
For example https://github.com/servo/servo seems a bit involved to set up for development but at the same time not too bad either.
I looked at Nix to help with multi-language builds (and cross compiling), but only had limited success.
In practice, I'd expect libraries to just call make/cmake/ninja for you, or (like openssl-sys) ask you to install the necessary libraries using your favourite package manager.
Since rust Python can theoretically access Tokio does it make it avoid the cpython gil issues
Their github.io page mentions interesting use cases though:
> RustPython can be embedded into Rust programs to use Python as a scripting language for your application, or it can be compiled to WebAssembly in order to run Python in the browser
Currently it's more about clarity and a nice clean code base, but it can only get faster from here
RustPython even cannot run `1+1` without calling `int.__add__` yet. And it is working on https://github.com/RustPython/RustPython/pull/4615
So it still has long way to go not C vs Rust but from the design level.
http://www.dannyvankooten.com/blog/2022/rewriting-interprete...
Some sort of sensible scripting language to do the game logic in.
Python was not the bottleneck, just the scapegoat for badly written code.
(1): e.g. awesome, blender
Not only did old examples often just not work, there was no serious code completion to facilitate creating anything from scratch.
Which is great for embedding or customizing your scripting language needs.
That being said, I've seen much worse languages being used to write compilers, so... who knows?
I'm much more nervous about maintaining invariants as you implement compilation passes, especially in the absence of powerful pattern-matching.
https://github.com/RustPython/RustPython/issues/1940#issueco...
The hardest part of supplanting CPython is the fact that the FFI is already validated on a huge amount of implementations. I believe Cinder and Pyston work out of the box but they are on older versions of python but Pyston wants to be merged back into CPython and so does Cinder (or at least what is relevant). On the other hand JIT in CPython can be achieved by other python packages. Pyston has also extracted the JIT and can be added to 3.7 - 3.10 by installing it. See https://pypi.org/project/pyston/
Pypy is a separate reference implementations that has tried to achieve something different but hasn't supplanted python for years. It has had a JIT and the ability to change garbage collectors but the system stuffers when interacting with C FFIs
Pyodide is inthe browser so its something completely different but has no support for CFFIs.
IronPython (.net), Jython are inactive. Also GIL removal from CPython has been attempted multiple times but now that CPython is being funded by Microsoft to become faster makes it more unlikely that CPython will be supplanted.
But I think OS devs dont really want to put optimization work into GraalVM, as their hard worked could get sucked up and locked behind the Enterprise Edition.
There are already other implementations. But CPython is the reference implementation. That's part of why we're only now seeing optimizations that reduce code clarity for reading. (i think, dont quote me on this)
[0] https://github.com/faster-cpython/ideas/blob/main/FasterCPyt...
CPython is also building a -no-gil compile-time option. If that gets traction, some of the big performance-oriented C extensions like Numpy etc would likely build a non-GIL extension version too.
Then, if RustPython's non-GIL implementation is compatible with CPython's, and their C ABI is compatible, those C extensions might work.
NumPy
pandas
Matplotlib
TensorFlow
PyTorch
These modules are critical to many of the workloads using Python (ML / AI / Data Science)The absolute number (or fraction) implemented in C is less important than the high profile ones. numpy/scipy alone are used in a huge number of projects so if you can't support those two libraries alone it's pretty much a non starter.
There are a lot that use the C API, even if some of those aren't implemented in C (some are actually implemented in Rust.)