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.

regex-redux
source secs mem gz busy cpu load
Rust 0.78 146,236 2458 1.99 53% 53% 61% 90%
C++ g++ 1.08 203,816 1315 3.38 78% 99% 65% 73%
reverse-complement
source secs mem gz busy cpu load
Rust 0.46 499,024 3040 0.83 26% 80% 47% 28%
C++ g++ 0.63 499,704 2093 0.64 0% 100% 2% 0%
n-body
source secs mem gz busy cpu load
Rust 3.31 836 1767 3.36 100% 1% 0% 1%
C++ g++ 4.09 1,800 1808 4.13 100% 0% 0% 0%
fannkuch-redux
source secs mem gz busy cpu load
Rust 7.28 1,168 1016 28.82 100% 97% 100% 100%
C++ g++ 8.08 1,900 980 31.45 98% 100% 98% 93%
fasta
source secs mem gz busy cpu load
Rust 0.77 1,848 2529 1.57 99% 1% 4% 100%
C++ g++ 0.78 2,468 2751 1.62 8% 99% 99% 3%
spectral-norm
source secs mem gz busy cpu load
Rust 0.71 2,696 1055 2.86 100% 100% 100% 100%
C++ g++ 0.72 1,216 1044 2.86 100% 100% 99% 100%
binary-trees
source secs mem gz busy cpu load
Rust 1.07 198,540 765 3.76 84% 100% 84% 83%
C++ g++ 1.04 154,824 1122 3.74 88% 100% 88% 86%
mandelbrot
source secs mem gz busy cpu load
Rust 0.93 32,788 763 3.69 100% 100% 99% 100%
C++ g++ 0.84 34,604 3542 3.28 98% 99% 98% 95%
pidigits
source secs mem gz busy cpu load
Rust 0.74 2,888 1420 0.76 0% 0% 100% 3%
C++ g++ 0.60 4,944 986 2.38 100% 100% 98% 100%
k-nucleotide
source secs mem gz busy cpu load
Rust 2.76 159,224 1691 10.20 90% 98% 91% 90%
C++ g++ 1.95 156,372 1631 5.95 73% 70% 92% 70%
Rust

rustc 1.48.0 (7eac88abb 2020-11-16)
LLVM version: 11.0

C++ g++

g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0