...and...
At the risk of being "one of those annoying Rust people" *, I'm concerned that you guys seem to be dismissing its performance potential, out of hand. So, I found a couple quick investigations into the matter.
Here's data from an article dated Nov. 2020:
Almost looks too good to be true! Admittedly, I have not checked the C code for any obvious performance gotchas.
Here's a more recent experiment (Dec. 2023), where Rust seemed to have a bit more trouble:
compiler | opt_level | runtime | ratio vs. best not parallel |
---|
rust | release parallel unsafe | 0.41 | 0.27 |
gcc | -O3 | 1.54 | 1.0 |
rust | release v2 unsafe | 1.56 | 1.01 |
rust | release v3 safe | 2.2 | 1.43 |
clang | -O3 | 2.27 | 1.47 |
clang | -O1 | 2.3 | 1.49 |
go | | 2.34 | 1.52 |
(some rows omitted, for brevity)
The rows starting with
gcc and
clang are compiling the C version. Obviously, the
rust compiler is compiling the Rust version and the
go compiler is compiling the Go version.
Taking only 43% longer (or running 70% as fast) is certainly in the same
ballpark as C! I'm not really counting the "unsafe" version, since I don't know how much safety it still retains vs. plain C.
Here's an explanation of Rust's performance characteristics, that I must admit I've barely skimmed so far.
Finally, here's a free, online book about using the Rust Programming Language on "Bare Metal" embedded systems, such as Microcontrollers. Granted, they seem to focus on 32-bit microcontrollers. I don't know if anyone is using it on 16-bit or smaller.
docs.rust-embedded.org
* FWIW, I'm not deeply familiar with Rust, myself, but have been meaning to look into it more. This little investigation was as much for my own edification as that of anyone else.