7 ms·
What else is cool about it besides being written in rust?
by 0des 5y ago
What else is cool about it besides being written in rust?
- Xylakant 5y agoCompiling the interpreter to webassembly and running python code in wasm sounds pretty cool.
- iddan 5y ago> You can compile RustPython to a standalone WebAssembly WASI module so it can run anywhere
- spicybright 5y agoCan you not do that with CPython or PyPy?
- BiteCode_dev 5y agoYou certainly can, as pyodide proves it, but it's a complicated task. Pyodide is upgraded only once in a while to a upper python version because of how much work it is. This makes it much easier.
- jjice 5y agoThey're working on JIT, which could really improve on PyPy (not that PyPy isn't great). It also supports WASM as a first class platform (as much as you can without standard library modules that interact with the OS). I also just like seeing another non-CPython implementation. Not game changing for the Python world, but I think it's pretty neat.
- chrisseaton 5y ago> They're working on JIT, which could really improve on PyPy Have they got a big new compiler idea?
- __s 5y agohttps://github.com/RustPython/RustPython/tree/main/jit https://github.com/RustPython/RustPython/tree/main/jit Pretty sparse. Uses cranelift tho, which is what Firefox is using for wasm For comparison, here's a complete JIT-for-befunge using cranelift: https://github.com/serprex/Befunge/blob/master/barfs/src/jit.rs https://github.com/serprex/Befunge/blob/master/barfs/src/jit... Rust is seeing ~5x improvement in compile time using cranelift for debug builds instead of llvm. Cranelift is much better suited as a jit library than llvm is. Bit of a pain postgres went the llvm route
- orra 5y ago> Cranelift is much better suited as a jit library than llvm is. Unladen Swallow is seared in my mind. It was a failed project, back in 2009, to improve the speed of CPython by using LLVM as a JIT.
- aardvark179 5y agoWas it really LLVM that was the problem, or the fact that there’s a lot more to making a dynamic language fast than compiling individual methods?
- chrisseaton 5y agoExactly. LLVM and Cranelift are essentially code generation backends when you’re applying them for dynamic languages. You need an entire actual custom compiler in front of them to get good code out of them.
- orra 5y agoSure, making a dynamic language fast is not easy. However, back then people thought LLVM was a magic wand. It wasn't. There were several problems. First, the Unladen Swallow team (IIRC) spent a lot of time fixing bugs in LLVM. Second, LLVM isn't fast at compiling code, at least not for a JIT. This is legitimately surprising, because the official LLVM Tutorial implements a JIT. Third, LLVM used to stand for Low Level Virtual Machine. I don't know when it stopped standing for that; clearly it hasn't for a long time. But with “Virtual Machine” in the title, you can see why people might have thought it would be suitable for implementing a dynamic language. cf. GraalVM these days.
- nerdponx 5y agoInteresting that we now have four performance-focused alternative implementations of Python: PyPy, GraalPython, Pyston, and now RustPython. There are also Jython and IronPython, although I don't know how successful/popular or actively-maintained those implementations are. Someone recently pointed out on IRC that Python is transitioning away from a language with "one implementation, and the implementation is the spec" to "one preferred implementation with an informal spec, but many alternative implementations". Now that PyPy v7.3.7 seems to support 3.8 without any issues that I've encountered, I'd strongly consider evaluating it for use in production code. It might be interesting to run some async webserver + data processing benchmarks or something across the various implementations. Maybe a good benchmark would be measuring total throughput on something like "process/sanitize some user-provided text file, then serve a prediction from a PyTorch model".
- tekknolagi 5y agoThere's also Skybison and Cinder, but I'm biased since I worked on both.
- nerdponx 5y agoI should have remembered Skybison/Cinder, it was posted on here not long ago. Heck, I probably should have mentioned Stackless too, which apparently is still being actively developed.
- agravier 5y agoNumerical computation libraries: numpy, scipy, ML libraries like sklearn, pytorch, and bindings for tensorflow, xgboost and many more must all work without any hiccup before data science and AI teams will consider switching away from CPython.
- KeplerBoy 5y agoThose teams still wouldn't switch because they wouldn't gain any performance from switching. After all CPython is just calling highly optimized, already compiled C, Fortran or Accelerator specific (CUDA, ROCm, TPU) code as far as they are concerned.
- stevefan1999 5y agoNo more fucking GIL bullshits
- dralley 5y agoIt doesn't have a GIL because it's using a lot of smaller individual locks. That ends up being much slower in practice.
- Jeff_Brown 5y agoOh, that's a big deal, yes. (For those unaware, GIL = global interpreter lock.)
- reikonomusha 5y agoI don’t think it’s a big deal if it’s not backwards compatible with the billions of lines of existing Python which use C extensions.
- BiteCode_dev 5y agoIt's most likely that the GIL will be removed in the next 5 years: https://docs.google.com/document/u/0/d/18CXhDb1ygxg-YXNBJNzfzZsDFosB5e6BfnXLlejd9l0/mobilebasic https://docs.google.com/document/u/0/d/18CXhDb1ygxg-YXNBJNzf...
- prabhu-yu 5y agoAre you sure, this does not have the GIL? I tried looking into documentation, I could not find such info. Can you please point the link?
- the_mitsuhiko 5y agoIt does not have a GIL but this also means it's not compatible with a lot of Python code that needs a GIL or C-extensions. Not having a GIL by itself is not tricky, being compatible and not having a GIL is.
- 5y ago
- Joker_vD 5y agoIt has 10000 commits in its git history!
- deleted 5y ago[deleted]
- Aachen 5y agoInteresting that this is the top post now. This is exactly what I think for most golang/rust/etc. submissions, but any such discussion (if any) has always been far down the thread. What changed, I wonder.
- omnicognate 5y agoThe fact that it now has some replies that say something worth reading. On its own, whinging about "written in rust" is thoroughly tedious and downvote-worthy.
- steveklabnik 5y agoYes, I think that's the difference here: this one is asking a legitimate question, and so is generating discussion. The others are almost always just complaining that the word "Rust" is in the title, which does not invite discussion and is not interesting.
- StevePerkins 5y agoI want to ask this question about virtually every "written in Rust" project that appears on HN.
- fnord123 5y agoAre you asking how link aggregation sites work? Or are you just noting that you're surprised at the overlap between the HN community and the Rust community?
- StevePerkins 5y agoI think the parent question, "What else is cool about it besides being written in rust?", speaks for itself. I understand that there are currently a large number (or at least a vocal number?) of HN readers with an interest in Rust. I have been here long enough to witness Lisp, Haskell, Node, Golang, Julia, and even .NET Core all go through similar cycles. However, Rust is the ONLY one on that list for which "___ written in Rust" is a nearly automatic trip to the top of the front page. It's weird. It feels like astroturf at times, and even if it's legitimate good faith then it's still overbearing. Just...... is there literally ANYTHING noteworthy about "_____" other than the programming language it was written in? I'm not sure how noteworthy that is, by itself, even if you have a strong interest in that language.
- BiteCode_dev 5y agoIn this particular case, the fact it's written in rust gives it some very interesting properties: - it makes compiling your entire project into a standalone executable trivial - the interpreter can be compiled to WASM way more easily than with something like pyodide - you can provision python with cargo, which mean no more fiddling with pyenv, deadsnake, epel, etc. and yet getting a consistent, to the minor version, python distribution - rewritting you hot path in rust becomes first class citizen. Since the python story is, start with python, and when you need to scale, you can always create an extension later, this is really attractive. All that has only value, of course, if the project reaches a good compat and is supported. But still, the possibilities it offer are not negligible.
- low_tech_love 5y agoThis question should be integrated into HN’s submit form.