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.

regex-redux
source secs mem gz busy cpu load
Rust 2.12 153,184 986 3.15 15% 33% 85% 15%
Go 29.64 438,516 802 62.79 58% 57% 53% 44%
binary-trees
source secs mem gz busy cpu load
Rust 3.37 199,768 721 12.27 88% 88% 100% 88%
Go 25.40 370,688 1005 87.09 86% 86% 86% 85%
n-body
source secs mem gz busy cpu load
Rust 6.07 940 1753 6.14 1% 100% 0% 0%
Go 21.25 1,588 1310 21.43 0% 100% 0% 0%
mandelbrot
source secs mem gz busy cpu load
Rust 1.70 30,424 1332 6.69 98% 98% 98% 99%
Go 5.47 31,104 905 21.78 99% 100% 99% 99%
k-nucleotide
source secs mem gz busy cpu load
Rust 5.17 134,552 1841 15.74 71% 91% 63% 80%
Go 11.86 160,068 1607 44.82 93% 94% 97% 94%
reverse-complement
source secs mem gz busy cpu load
Rust 1.62 994,820 1376 2.84 25% 26% 24% 100%
Go 3.55 1,783,340 1338 6.26 45% 32% 41% 59%
spectral-norm
source secs mem gz busy cpu load
Rust 1.98 2,156 1126 7.93 100% 100% 100% 99%
Go 3.95 2,500 548 15.72 100% 99% 100% 99%
fannkuch-redux
source secs mem gz busy cpu load
Rust 11.13 876 1020 43.78 99% 95% 100% 100%
Go 17.53 11,672 896 70.01 100% 100% 100% 100%
fasta
source secs mem gz busy cpu load
Rust 1.51 2,036 1961 4.60 83% 74% 73% 75%
Go 2.07 3,568 1358 5.67 80% 75% 40% 79%
pidigits
source secs mem gz busy cpu load
Rust 1.75 2,980 1366 1.78 0% 1% 1% 100%
Go 2.05 8,444 603 2.10 29% 1% 35% 37%
Rust

rustc 1.38.0 (625451e37 2019-09-23)
LLVM version: 9.0

Go

go version go1.13 linux/amd64