The Computer Language
Benchmarks Game

Rust versus Go fastest programs

Back in April 2010, Russ Cox charitably suggested that only fannkuch-redux, fasta, k-nucleotide, mandlebrot, nbody, reverse-complement and spectral-norm were close to fair comparisons. As someone who implemented programming languages, his interest was "measuring the quality of the generated code when both compilers are presented with what amounts to the same program."

Differences in approach - to memory management, parallel programming, regex, arbitrary precision arithmetic, implementation technique - don't fit in that kind-of fair comparison — but we still have to deal with them.

These are only the fastest programs. There may be additional measurements for programs which seem more-like a fair comparison to you. Always look at the source code.

binary-trees
source secs mem gz busy cpu load
Rust 3.33 199,664 721 12.08 87% 100% 88% 87%
Go 25.17 361,152 1005 86.86 87% 89% 86% 84%
n-body
source secs mem gz busy cpu load
Rust 6.07 944 1753 6.14 0% 0% 100% 1%
Go 21.25 1,588 1310 21.48 0% 1% 100% 0%
regex-redux
source secs mem gz busy cpu load
Rust 2.10 153,076 986 3.14 30% 17% 83% 19%
Go 6.84 340,376 810 9.43 30% 43% 13% 52%
mandelbrot
source secs mem gz busy cpu load
Rust 1.70 30,492 1332 6.70 98% 98% 98% 100%
Go 5.47 31,088 905 21.77 100% 99% 99% 99%
k-nucleotide
source secs mem gz busy cpu load
Rust 5.40 135,184 1749 17.13 60% 92% 69% 96%
Go 11.77 160,184 1607 44.52 94% 98% 94% 92%
spectral-norm
source secs mem gz busy cpu load
Rust 1.97 2,196 1126 7.87 100% 100% 99% 99%
Go 3.94 2,740 548 15.74 100% 100% 100% 100%
reverse-complement
source secs mem gz busy cpu load
Rust 2.21 995,040 1871 3.10 1% 48% 24% 67%
Go 3.83 1,782,940 1338 6.67 21% 74% 16% 62%
fannkuch-redux
source secs mem gz busy cpu load
Rust 10.62 944 1016 41.73 100% 93% 100% 100%
Go 17.56 1,524 900 70.00 100% 100% 100% 100%
fasta
source secs mem gz busy cpu load
Rust 1.51 2,044 1906 4.60 74% 83% 73% 74%
Go 2.08 3,560 1358 5.61 80% 37% 76% 78%
pidigits
source secs mem gz busy cpu load
Rust 1.75 3,052 1366 1.78 1% 0% 1% 100%
Go 2.10 8,448 603 2.17 1% 48% 55% 0%
Rust

rustc 1.39.0 (4560ea788 2019-11-04)
LLVM version: 9.0

Go

go version go1.13 linux/amd64