On Compact Rust Code

A while ago there was quite a discussion about Rust binary size and some people made their point that Rust binaries are huge while C allows you to get a really tiny one.

But lately I've been experimenting with the Rust for embedded targets and had several deep dives into binary size minimization techniques. It turns out that if you don't extensively use the features that require much run-time support and all the convenience provided by standard library, even current stable rustcdoes not generate too much useless code.

Moreover that: using aggressive size optimizations and some linker-based tricks make it possible to achieve the hundred-bytes-level sizes.

So I've got some inspiration from the tiny-rust-demo by Keegan McAllister and some inspiration from the kilo by Antirez and tried to implement a small editor in Rust.

The result is based: my first Linux application (not the GNU/Linux one) that resembles some of emacs keybindings (since I use emacs daily it was the easiest way to go) fits into 32 KiB and only requires Linux kernel to run.

During the process I tried to use Claude Code extensively but it seems that true vibe coding does not work very good for this level of applications though it helps with tests really much. Need to use it a bit more to make some conclusion but currently it seems a very useful (rather expensive though) tool for developer. At least I'll definitely use it at work: it helps to reduce the volume of boilerplate and automates some dull tasks.

Not sure if anyone needs one more editor, but coincidentally MS released their edit this week as well. And yes, it's in Rust too, and yes, it has no external dependencies too. It's ~300 KiB, not 30 KiB though. But it's more like full-featured editor, not just a PoC.

So the approach works and is already adopted by corporations.

There is a russian version of this post