The Computer Language
Benchmarks Game

Rust versus C++ g++ fastest programs

Always look at the source code.

These are only the fastest programs. Look at the other programs. They may seem more-like a fair comparison to you.

n-body
source secs mem gz busy cpu load
Rust 3.31 836 1767 3.38 1% 1% 1% 100%
C++ g++ 4.09 1,748 1808 4.12 0% 100% 1% 0%
fannkuch-redux
source secs mem gz busy cpu load
Rust 6.88 1,224 1016 26.99 94% 99% 99% 100%
C++ g++ 8.07 1,848 980 31.38 93% 98% 100% 98%
fasta
source secs mem gz busy cpu load
Rust 0.93 2,332 1906 3.07 88% 82% 80% 81%
C++ g++ 1.04 4,464 2344 3.87 92% 93% 93% 93%
spectral-norm
source secs mem gz busy cpu load
Rust 0.72 2,504 1055 2.85 100% 99% 99% 100%
C++ g++ 0.72 2,360 1044 2.85 99% 100% 99% 100%
pidigits
source secs mem gz busy cpu load
Rust 0.74 2,968 1366 0.75 1% 0% 0% 100%
C++ g++ 0.71 4,184 513 0.71 0% 100% 0% 0%
binary-trees
source secs mem gz busy cpu load
Rust 1.20 200,180 721 4.34 87% 87% 88% 100%
C++ g++ 1.12 200,184 890 4.05 88% 88% 88% 99%
mandelbrot
source secs mem gz busy cpu load
Rust 0.92 32,716 763 3.66 100% 99% 100% 100%
C++ g++ 0.84 34,608 3542 3.27 98% 98% 96% 99%
regex-redux
source secs mem gz busy cpu load
Rust 1.28 153,400 986 1.76 14% 29% 83% 12%
C++ g++ 1.08 203,848 1315 3.40 100% 64% 73% 78%
reverse-complement
source secs mem gz busy cpu load
Rust 0.75 995,164 1330 1.37 60% 49% 47% 26%
C++ g++ 0.63 499,624 2093 0.64 0% 0% 100% 2%
k-nucleotide
source secs mem gz busy cpu load
Rust 3.22 131,280 1578 10.56 92% 89% 73% 74%
C++ g++ 1.93 156,432 1631 5.93 69% 70% 70% 98%
Rust

rustc 1.47.0 (18bf6b4f0 2020-10-07)
LLVM version: 9.0

C++ g++

g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0