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.

binary-trees
source secs mem gz busy cpu load
Rust 1.20 111,528 721 4.32 87% 87% 86% 99%
C++ g++ 1.53 112,820 1270 4.03 99% 59% 52% 53%
n-body
source secs mem gz busy cpu load
Rust 3.43 692 1753 3.44 100% 1% 0% 0%
C++ g++ 3.94 1,604 1808 4.02 0% 1% 100% 1%
fannkuch-redux
source secs mem gz busy cpu load
Rust 7.29 1,016 1020 28.68 100% 100% 99% 95%
C++ g++ 7.92 1,700 980 30.88 100% 99% 98% 93%
spectral-norm
source secs mem gz busy cpu load
Rust 0.71 2,468 817 2.83 100% 99% 99% 99%
C++ g++ 0.72 2,348 1044 2.84 100% 99% 99% 99%
pidigits
source secs mem gz busy cpu load
Rust 0.88 2,928 1420 0.89 100% 1% 0% 0%
C++ g++ 0.89 4,236 513 0.89 0% 0% 100% 0%
fasta
source secs mem gz busy cpu load
Rust 0.93 2,180 1961 3.13 90% 82% 83% 83%
C++ g++ 0.85 2,020 2711 3.13 92% 92% 92% 93%
reverse-complement
source secs mem gz busy cpu load
Rust 0.75 994,900 1330 1.37 28% 27% 46% 81%
C++ g++ 0.63 499,668 2093 0.64 2% 0% 0% 100%
regex-redux
source secs mem gz busy cpu load
Rust 1.30 153,268 986 1.80 12% 28% 83% 15%
C++ g++ 1.03 275,752 2850 2.19 36% 37% 100% 40%
mandelbrot
source secs mem gz busy cpu load
Rust 1.19 30,608 719 4.72 98% 98% 99% 100%
C++ g++ 0.88 34,608 3542 3.47 98% 100% 98% 97%
k-nucleotide
source secs mem gz busy cpu load
Rust 2.81 131,400 1578 8.83 86% 73% 90% 64%
C++ g++ 1.98 156,108 1631 5.92 96% 67% 68% 68%
Rust

rustc 1.45.0 (5c1f21c3b 2020-07-13)
LLVM version: 9.0

C++ g++

g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0