← Back to context

Comment by erikbye

9 months ago

Rust... what is it good for? "Systems programming" ...

Rust is not good for raw performance. Neither for prototyping and iteration.

Personally I think operating systems (kernels) should be as performant as possible, and C/C++ has been good enough for decades.

Anyone really unhappy with Linux/BSD/Windows/macOS performance?

What systems are we talking about that benefits from Rust? Advanced weapon systems that should absolutely not fail? Controllers for air planes? Traffic controllers? Radar? Power grid?

Google, fb, amazon, etc. use C/C++ to squeeze the most performance out of anything I/O heavy, and security is not an issue that deep in the stack, that's not the exploitation layer.

Ok, we're going from a bunch of complaints about Rust being bad for fast prototypes for indie development to the idea that Rust is bad at everything. This is silly.

"Syzbot and the Tale of a Thousand Kernel Bugs" [1] is my favorite talk on this subject. The Linux kernel is adding security bugs faster than they can be fixed. This is an unsustainable situation--it is not "good enough"--and nobody really has any ideas to significantly improve things beyond adoption of memory safety.

[1]: https://www.youtube.com/watch?v=qrBVXxZDVQY

  • > Ok, we're going from a bunch of complaints about Rust being bad for fast prototypes for indie development to the idea that Rust is bad at everything.

    No, not at all, that's not what I meant. I think it's forte for now is better security at the cost of some performance and productivity (iteration speed).

> Anyone really unhappy with Linux/BSD/Windows/macOS performance?

I wasn't unhappy with Windows' performance in the 90s until I saw BeOS. This is the kind of thing we're in the dark about what could be because the faster, rewritten fron scratch, free from API baggage systems are nowhere to be found.

  • Haven't used BeOS, but to clarify, I do have issues with Windows and performance, especially general input latency and responsiveness when compared to Linux, as I use both daily. But overall I think it's decent, and at the very least, not the fault of the language used, but more about legacy issues and technical debt. Anyone having worked with winapi and mfc knows the codebase is a mess.

Well, as far as I can tell, in the big language shootout (which is still the only decent language benchmark I know, but if you have others, I'd be happy to read them), in all the individual benchmarks I've looked at Rust is either first or within 3% performance of being first. So, this suggests that Rust is actually pretty good for raw performance.

In addition, I know that I'm way more productive for prototyping and iteration in Rust than in C, C++ (and I used to write C++ code professionally for a while), JavaScript, Go, Python (and I've been writing professionally in these three languages for a while now) etc. I _might_ be more productive in Java or OCaml. Yes, this is entirely anecdotal and it depends heavily on the kind of problems you're dealing with. I tend to focus on problems that have complicated invariants, and for which reproducing/pinpointing the issue in a debugger is a big annoyance.

> Google, fb, amazon, etc. use C/C++ to squeeze the most performance out of anything I/O heavy, and security is not an issue that deep in the stack, that's not the exploitation layer.

Interestingly, all these companies are migrating some of their systems to Rust. This suggests that they find the language convincing enough.

  • > Interestingly, all these companies are migrating some of their systems to Rust. This suggests that they find the language convincing enough.

    I feel most large companies and some smaller ones are interested in trying out Rust, it's trendy. But time will show for which parts the switch was advantageous; and I'm very interested in the findings. The premise of the language is indeed convincing a lot of people. People do however, choose the wrong tool for the wrong job all the time, OP's article in point.

> Personally I think operating systems (kernels) should be as performant as possible, and C/C++ has been good enough for decades.

If that how you want your OS, that's fair enough. But I think a lot of people are happy to trade (to some degree, at least) performance for security, and would prefer that their OSs are as secure as possible first, and as performant as they can be second.

No, I'm not concerned with Linux/BSD/macOS performance, it's pretty good (I took Windows out because it does have performance issues [0]!). What I am concerned about is security bugs, memory errors, buffer overflows etc, all of the things Rust attempts to solve [1].

I think for weapons & flight control, ATC systems, we already have Ada that's designed for "can't fail systems".

[0] https://www.blobstreaming.org/former-microsoft-developer-say...

[1] https://www.zdnet.com/article/microsoft-70-percent-of-all-se...

  • I agree, operating systems should have less out-of-bounds memory issues. Is that Rust's place? Replacing the parts of OS code where it's OK to sacrifice some performance?

    Ada has a foothold for sure, but there's a surprising amount of C++ in military planes and weapon systems.

    I didn't read [0], but the parts of Windows that's poorly performing is not the fault of the language.

Rust is already in Windows: https://www.reddit.com/r/rust/comments/12yg3cp/microsoft_rew...

Linux added Rust support: https://docs.kernel.org/rust/

  • Well aware, and it affects none of my points.

    • You asked:

      > What systems are we talking about that benefits from Rust? Advanced weapon systems that should absolutely not fail? Controllers for air planes? Traffic controllers? Radar? Power grid?

      You seem to be listing niche, specialised systems where a failure would be critical. But a simpler answer that is missing: mainstream operating systems — as I said, both Windows and Linux have been investing in Rust. Mainly as a way to increase memory safety.

      1 reply →