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 5.98 688 1753 6.01 0% 0% 100% 1%
C++ g++ 7.70 1,612 1879 7.81 100% 0% 1% 1%
binary-trees
source secs mem gz busy cpu load
Rust 3.30 174,904 721 11.87 87% 88% 87% 99%
C++ g++ 3.96 113,236 809 12.86 74% 84% 98% 69%
reverse-complement
source secs mem gz busy cpu load
Rust 1.68 994,920 1330 2.91 46% 79% 24% 25%
C++ g++ 1.89 499,672 2093 1.94 100% 2% 1% 1%
pidigits
source secs mem gz busy cpu load
Rust 1.75 2,984 1420 1.83 0% 2% 3% 100%
C++ g++ 1.82 4,312 513 1.87 1% 1% 2% 100%
spectral-norm
source secs mem gz busy cpu load
Rust 1.99 2,428 1126 7.91 99% 100% 99% 99%
C++ g++ 1.99 2,408 1044 7.89 99% 99% 99% 99%
fannkuch-redux
source secs mem gz busy cpu load
Rust 11.06 1,020 1016 43.39 100% 99% 100% 93%
C++ g++ 10.71 1,708 980 42.33 100% 96% 100% 100%
fasta
source secs mem gz busy cpu load
Rust 1.51 2,172 1961 4.77 76% 86% 77% 77%
C++ g++ 1.46 2,024 2711 4.40 75% 76% 75% 76%
mandelbrot
source secs mem gz busy cpu load
Rust 1.71 32,704 1332 6.73 98% 98% 98% 100%
C++ g++ 1.51 26,256 1791 6.01 100% 99% 99% 99%
regex-redux
source secs mem gz busy cpu load
Rust 2.23 153,800 986 3.28 14% 16% 85% 32%
C++ g++ 1.86 203,856 1315 4.49 99% 50% 48% 44%
k-nucleotide
source secs mem gz busy cpu load
Rust 5.58 134,504 1841 16.64 73% 93% 57% 76%
C++ g++ 3.88 156,164 1631 12.09 72% 92% 71% 77%
Rust

rustc 1.43.0 (4fb7144ed 2020-04-20)
LLVM version: 9.0

C++ g++

g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0