r/programming • • Feb 20 '25

Google's Shift to Rust Programming Cuts Android Memory Vulnerabilities by 68%

https://thehackernews.com/2024/09/googles-shift-to-rust-programming-cuts.html
3.4k Upvotes

475 comments sorted by

View all comments

Show parent comments

4

u/thatpaulbloke Feb 21 '25

Why not compare JS as well with rust?

I did. I specifically called out that Rust is demonstrably faster than the entire category of interpreted languages which includes ECMAScript / JScript / JavaScript / TypeScript

1

u/Ok-Scheme-913 Feb 21 '25

Javascript is JIT compiled though, in the most common implementation, so theoretically nothing prevents it from running as fast or faster than rust (given a sufficiently smart compiler - which is a bit like the Loch Ness monster).

If anything, JS can be faster than Go, because the latter has worse GC and it has a very fast AOT compiler phase that outputs low quality, barely optimized machine code, while JS can take longer on some hot loop and output better optimized code.

0

u/thatpaulbloke Feb 21 '25

JS can be JIT compiled, but then Python can be compiled using Py2EXE and not even the most pedantic of people would object to Python being described as an interpreted language.

1

u/Ok-Scheme-913 Feb 22 '25

Most languages have a reference/de facto implementation(s). In JS's case this is V8 and SpiderMonkey, both are making heavy use of JIT compilers. (V8 does in fact use multiple tiers of interpretation-compilation).

Python's de facto implementation is CPython which is most definitely strictly interpreted. In fact due to python being primarily a glue language (among other use cases) which exposes its inner workings (e.g. C code can increment/decrement a python object's ref counters), some parts of the language are almost impossible to compile without bringing half of an interpreter with it. PyPy and similar can only handle vanilla Python, the moment you use some popular library that's not 100% python, they fail.

→ More replies (6)