upvote
> I wonder if the vast majority of that performance boost could be obtained if efforts were directed towards improving programs in their own language, like the ESLint team is doing, rather than going straight for a full-on rewrite in Rust. My nagging suspicion is that this is very much possible, as seen for instance in VS Code pushing the boundaries of Electron apps. But that does require some effort.

I just don't think so, personally. You just really don't have to try when it comes to things like 0 allocation in Rust, and when you do put in effort it's for things like explicit SIMD. For something like typescript you have to put in a lot of effort for 0 allocations and then something like explicit SIMD just isn't really on the table.

In Rust I have real threads, I can manage IO, etc.

I'm sure you can push these languages and runtimes very far but there just are limits.

I've seen this so many times. Even with binaries or services that people say spend 90% of time in IO, I've sped them up with naive ports to Rust. Why? Because IO in Rust is going to be faster - freeing up your event loop by reducing contention will reduce latency, reducing allocations will reduce latency, control over task allocation will reduce latency, etc. I've just seen it too many times where "it's just a dumb pipe between services, language doesn't matter" turns out to be "language bound".

I'm sure they will improve performance by optimizing their use of the language but it's just not going to compete with a rust implementation.

reply
IME Rust is easier way to reach perf improvements & has higher ceiling, & this goes back to rewriting a cardgame engine pre-AI (both engine in wasm & server from node)

I'd spent years tuning for JITs & it was so nice to not have to worry about their fickle nature

But I also don't think people should think they're helping by opening issues rambling about RIIR. It's up to the project leads & don't worry they know about Rust. Rewrites are not something for flyby PRs to implement

reply
> Rust code benefits from memory safety, from the compile-time guarantees that make it easier for AI agents to write and maintain it…

Rust is not "safe" as you think unless there is no "unsafe", no FFI, no link to C library and libc.

For example, Java is memory safe but the recent Java4Shell happen because it uses unsafe code to handle base64.

reply
When people use the term "memory safety" they almost always mean "unless you use the memory unsafe escape hatches that basically all languages provide".

But you knew that. Don't nit pick.

reply
As if not a lot of Rust marketing was based on blurring exactly the distinction between "completely eliminates all memory safety issue" (Safe Rust) and "competed with C/C++ as a system programming language" (Rust including its unsafe part).
reply
Even comparing to C++ it’s a huge improvement, because all of C++ is unsafe. Unsafe rust, even in codebases that utilize it, is a small minority of the code.
reply
This "all C++ is unsafe" is similarly exaggerated Rust marketing claim. It is logically equivalent to "all Rust code is unsafe because it may contain unsafe" and nonsense for the same reason. The only claim you can make is that it is easier to screen for the unsafe parts because it is marked more clearly. I would agree with this much more limited statement.
reply
> This "all C++ is unsafe" is similarly exaggerated Rust marketing claim

It really isn't, and because I have no doubt you made this assertion genuinely that is itself a problem for their language.

C++ APIs with broad - and thus actually safe - contracts are very rare. Most of the time what we'll find is that there were a few "obvious" assumptions narrowing a seemingly wide contract, an iterator that's assumed to be non-null, a parameter that's expected to be in bounds, or to have this or that desirable property - and if it doesn't while Rust would reject the program alas in C++ it's just Undefined Behaviour so too bad you lose.

The quintessential example is sorting. Maybe we've got a billion Doodads and we sort them. What happens if our sort order is incoherent nonsense, either because our type doesn't actually have a total order or because we provided an explicit ordering rule which was not coherent? In Rust the answer is that this remains safe, since there was no coherent order we can't really say that the Doodads are now "sorted", but the same billion Doodads are there. In C++ that's Undefined Behaviour. Anything could happen. In the real world maybe some of the C++ Doodads are corrupted, or duplicated, or the total number of Doodads changes, maybe arbitrary code is executed, it's a horror show.

reply
The fact is that in practice Rust essentially eliminates all memory safety issues. You can describe that however you want, but most people are perfectly happy with "Rust is memory safe", and you know what they mean when they say it.
reply
In practice Rust does not eliminate all memory safety issues. So it depends what you mean by "essentially". And then the question is what you compare it to. It is certainly much better than average C++ code.
reply
It absolutely does.

> Our historical data for C and C++ shows a density of closer to 1,000 memory safety vulnerabilities per MLOC. Our Rust code is currently tracking at a density orders of magnitude lower: a more than 1000x reduction.

https://blog.google/security/rust-in-android-move-fast-fix-t...

I await your tediously predictable "1000x reduction isn't eliminated" response.

reply
I think this data is confounded in many ways, even assuming I would trust a blog post. But I also do not really doubt that there is advantage of average Rust code over average C++ code. There are C projects (and I suspect also C++ projects) with a very good track record in terms of memory safety, and they do it somehow magically without Rust. I think that would be a more interesting comparison to study. But ultimately, I also do not think this even a terrible important or interesting questing. It may be much more important to a company that tries to put unhackable advertisement and spyware platform into everybody's pockets. For my own security the fact that I get limited security support for Rust packages is far more concerning than memory safety ever was.
reply
> There are C projects (and I suspect also C++ projects) with a very good track record in terms of memory safety

Such as? I have never heard of any that had even vaguely good memory safety track records, unless they either a) never free memory (this is how Ada solves the problem), or b) aren't programs where memory safety is a significant factor, so nobody is looking (e.g. single player games, compilers, shells).

reply