4 ms·
> Low-level and high-performance code is not "pretty" by modern standards, as it often requires DMA and tight control over data placement in order to fully leve
by jnxx 6y ago
> Low-level and high-performance code is not "pretty" by modern standards, as it often requires DMA and tight control over data placement in order to fully leverage instruction-level and hardware-level parallelism.
This is true if you look at implementations like these:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust-gpp.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
for example:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/mandelbrot-rust-8.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
vs.
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/mandelbrot-gpp-4.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
I'd say the C++ code in this particular case is not only much longer but also uglier.
However, how much of a fraction of C++ code in use does really require direct control over DMA calls? If you could get an at least equally fast result as when writing "normal C++" in Rust, with more safety and less effort for debugging, would this not be tempting for many people using C++? Because this is what I observed in my case. And this given that I've written no more than a few hundred lines of performance-critical code in Rust, and have worked for > 10 years on performance-critical code in C++ and C.