The Computer Language
Benchmarks Game

C gcc versus Rust 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
C gcc 0.80 152,244 1397 2.02 48% 53% 100% 53%
Rust 1.28 153,400 986 1.76 14% 29% 83% 12%
fasta
source secs mem gz busy cpu load
C gcc 0.82 2,900 2268 3.28 100% 99% 100% 100%
Rust 0.93 2,332 1906 3.07 88% 82% 80% 81%
pidigits
source secs mem gz busy cpu load
C gcc 0.73 2,844 416 0.78 0% 100% 6% 0%
Rust 0.74 2,968 1366 0.75 1% 0% 0% 100%
spectral-norm
source secs mem gz busy cpu load
C gcc 0.72 1,216 569 2.85 99% 100% 100% 99%
Rust 0.72 2,504 1055 2.85 100% 99% 99% 100%
fannkuch-redux
source secs mem gz busy cpu load
C gcc 7.53 892 910 29.41 99% 98% 100% 93%
Rust 6.88 1,224 1016 26.99 94% 99% 99% 100%
reverse-complement
source secs mem gz busy cpu load
C gcc 0.87 694,780 820 1.36 18% 99% 12% 28%
Rust 0.75 995,164 1330 1.37 60% 49% 47% 26%
k-nucleotide
source secs mem gz busy cpu load
C gcc 3.71 130,048 1506 12.15 100% 90% 82% 55%
Rust 3.22 131,280 1578 10.56 92% 89% 73% 74%
n-body
source secs mem gz busy cpu load
C gcc 4.30 8 1391 4.32 100% 0% 0% 0%
Rust 3.31 836 1767 3.38 1% 1% 1% 100%
mandelbrot
source secs mem gz busy cpu load
C gcc 1.27 31,480 1135 5.08 100% 99% 100% 100%
Rust 0.92 32,716 763 3.66 100% 99% 100% 100%
binary-trees
source secs mem gz busy cpu load
C gcc 1.78 168,764 809 5.23 63% 69% 100% 62%
Rust 1.20 200,180 721 4.34 87% 87% 88% 100%
C gcc

gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0

Rust

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