placeholder

Rewriting m4vgalib in Rust - Cliffle

If this isn't your first time visiting my blog, you may recall that I've spent the past several years building an elaborate microcontroller graphics demo using C++.

Click to view the original at cliffle.com

Hasnain says:

This is from a while ago - lessons learnt from porting an embedded graphics library from C++ to Rust, a comparison of the performance you can get, but also a good discussion of developer productivity and cognitive load.

“This is an interesting test case for Rust, because we're very much in C/C++'s home court here: the demo runs on the bare metal, without an operating system, and is very sensitive to both CPU timing and memory usage.

The results so far? The Rust implementation is simpler, shorter (in lines of code), faster, and smaller (in bytes of Flash) than my heavily-optimized C++ version — and because it's almost entirely safe code, several types of bugs that I fought regularly, such as race conditions and dangling pointers, are now caught by the compiler.”

Posted on 2020-01-01T19:28:39+0000