Rust Binary Size: How It Stacks Up

Rust's compiled binaries, when fully optimized, can be significantly smaller than C++ static executables (e.g., 256KB for Rust vs. 662KB for C++ in one benchmark). However, a default 'Hello World' Rust binary can be much larger than a C equivalent (e.g., 2.3MB vs. 14KB) due to static linking and included debug info by default. With dynamic linking and stripping, both Rust and C++ can achieve similar minimal sizes (around 16.5KB).

Sources

Open the full topic