Oh boy, are we *Seriously* going to compare sorting performance as a metric now? I wasn't aware the vast majority of code execution was doing sorting algorithms.
It's just a baseline. If it couldn't do that much, we'd probably be having a different discussion.
Also, as you yourself admitted: In *practical* workloads, Rust is about 30% slower. Which is, again, why C reigns supreme at the HW/Driver layer.
You're conveniently ignoring the part where unsafe was virtually the same speed. If need be, one can drop to unsafe mode
in just the limited hotspots where necessary, which is usually a tiny subset of the code. Everywhere else, you can exploit the additional safety it provides. And everywhere, you can benefit from its richer abstractions.
BTW, I just spent a day debugging a random utility written in C, about 15 years ago, that wasn't doing anything fancy and had zero justification for not being written in C++. The bugs it had were all memory bugs, of the sort you'd never find in decent C++ code (thanks to STL).
But hey, lets make a Rust NVIDIA driver; I'm sure nobody here will mind a 30% performance loss in games;
I presume this is a disingenuous argument, since you don't seem so clueless as to think that 100% of the a game's critical path is spent burning CPU cycles in the GPU's driver code. Either way, it's not a good look for you.
If about 10% of the time in a game's critical path is spent in the driver, and all of that time is CPU time (i.e. not blocking on bus transfers or waiting on the GPU to do something, which seems unlikely), then running 70% as fast would equate to that piece of the pie taking 1.43x as long, which works out to only about a 4.2% performance loss as it relates to FPS.
On the flip side, a language like Rust gives you access to better algorithms and data structures, which might enable better algorithmic optimizations than one would attempt in plain C.
Finally, we can presume that driver developers know how to use profilers to find hotspots, which they can optimize by using unsafe mode, plain C, or asm, as the situation demands.
We shouldn't forget the opportunity cost that comes from using a more labor-intensive and error-prone language. By having the bulk of the code in a higher-level language than C, they should have more time to pursue both algorithmic and code optimizations.
The Linux kernel devs clearly get it. That's why they
started using Rust in driver code. By volume, the drivers are probably the majority of the kernel sources and most of the time in them tends to be waiting on the device, itself.
it's not like everyone here spends a grand plus every year for smaller performance improvements. [sarcasm heavily implied]
The topic is emotive enough. I think the discourse isn't helped by sarcasm.