Member-only story
Rust vs Go for a CLI Tool: 0.3 MB vs 2.4 MB, and the Build-Time Surprise
The same word-frequency CLI in both languages. Rust’s binary was 8x smaller, the run speed tied, and the build times flipped in a way I did not expect
Rust and Go are the two go-to languages for a fast command line tool: one binary, no runtime to install, starts instantly. So which should you reach for?
I wrote the exact same CLI in both: read a text file, count word frequency, print the total and the top 10. Then I measured the three things that actually matter for a CLI: binary size, run speed, and build time. The results were not a clean sweep for either side.
Rust Go
binary (stripped) 0.30 MB 1.54 MB (2.36 MB unstripped)
run, 17 MB file ~0.10 s ~0.07 s (a tie in practice)
clean build 2.35 s 2.25 s (about equal)
rebuild (1 edit) 2.06 s 0.07 s (Go ~30x faster)I will be sharing the code, each measurement, and the one tradeoff that explains the build-time gap. Everything ran on an Apple M4 Max, Rust 1.88 and Go 1.27.










