18 ms·
Python interpreter written in rust reaches 10000 commits
- jakearmitage 5y agoI wonder how easy it is to customize/adapt the grammar. The possibility of using this as an embedded scripting language is amazing, specially if you can easily expand stuff to your domain.
- 0des 5y agoWhat 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.
- 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.
- rq1 5y agoDid they get rid of the GIL?
- arthurcolle 5y agoapparently they did
- reikonomusha 5y agoGetting rid of the GIL isn’t the hard part. It’s getting rid of the GIL and having existing Python code continue to work, with C extensions and all.
- thomasjudge 5y agoWhere is this documented
- rafaelgarrido 5y agoThere's some info on the proposal here: https://news.ycombinator.com/item?id=28896367 https://news.ycombinator.com/item?id=28896367
- quietbritishjim 5y agoI think the root comment is asking whether this new Python-on-Rust interpreter for rid of the GIL. Your link is about the existing CPython interpreter.
- grawp 5y agoWhy document something they have not implemented?
- michaelmior 5y agoBecause rightly or wrongly, tons of existing Python code implicitly requires on the GIL to function correctly. Especially when you have C extensions that may not be thread-safe.
- deleted 5y ago[deleted]
- thurn 5y agoBeing able to embed this inside a rust program for scripting/the ability to tweak behavior at runtime without recompiling could be really cool. Although my dream is still that someone makes an interpreted subset of Rust itself.
- tcard 5y agoNot for Rust itself, but there's an interpreter for Rust's MIR: https://github.com/rust-lang/miri https://github.com/rust-lang/miri
- pkolaczk 5y agoRune is pretty close, although it is dynamic (https://github.com/rune-rs/rune https://github.com/rune-rs/rune), Mun seems to be getting in that direction as well (and has a static type system!) but has fewer features (https://github.com/mun-lang/mun https://github.com/mun-lang/mun)
- gostsamo 5y agoAt a glance I didn't find a percentage of compatibility with c python. Is it tracked somewhere?
- klyrs 5y agoYeah, this is a really weird milestone. A policy of eager commits, never squashing, and extreme indecision could easily net 1k commits per developer day. Not saying that's what's happening here or anything... but this is a really bad metric for progress. But I find it noteworthy (inasmuch as I'm writing this comment) because the phenomenon is real. I've heard first-hand horror stories of shops that use commits per day as a serious metric, and the result is horrible.
- gostsamo 5y agoI can accept that someone involved in the project is happy with the number of commits and though I don't care much about it, I don't mind them being happy either. I'm actually, truly, and only interested to know how usable this project is.
- low_tech_love 5y agoWait, it's not called Rython?
- INTPenis 5y agoCopperhead would make more sense, since it's a metal that rusts.
- ZiiS 5y agoBy definition only iron rusts, but that name is gone.
- UnpossibleJim 5y agoPyrite then?
- kevin_thibedeau 5y agoScale
- orra 5y agoMmm, to rust can have a specific meaning, especially in chemistry, of iron oxidization. Nonetheless, there is also a more general meaning of corrosion of other metals. (It's entirely normal for words to have both specific and general meanings.)
- thebigspacefuck 5y agoCopper doesn’t rust as it doesn’t contain any Iron.
- INTPenis 5y agoOh right, I was thinking of the green patina bronze got. Copper gets that too after many years in oxygen.
- 5y ago
- _ea1k 5y agoIn other news, graal python has gotten to ~13k commits. Is there some significant meaning to this from a real compatibility and user experience standpoint?
- ksec 5y agoHacker News Guidelines >please use the original title, unless it is misleading or linkbait; don't editorialize.
- stared 5y agoI love its logo!
- Reason077 5y agoHow about a Rust interpreter written in Python? Now that would be something worthy of a top HN post!
- johnsoft 5y agoIf you thought compile times were bad before…
- lostmsu 5y agoThen that would be the perfect solution for you! Interpreted Rust has no compilation step, you can jump straight to execution!
- sebiw 5y agoTechnically speaking, Rust is a compiled language, which means an interpreter won't do the job.
- DrMeepster 5y agoYou can interpret its MIR (mid-level intermediate representation) like Miri or const evaluation does
- sebiw 5y ago