The Computer Language
Benchmarks Game

C gcc versus Rust fastest programs

Always look at the source code.

These are only the fastest programs. Do some of them use manually vectorized SIMD? Look at the other programs. They may seem more-like a fair comparison to you.

spectral-norm
source secs mem gz busy cpu load
C gcc 0.40 872 1197 1.58 100% 100% 100% 98%
Rust 0.72 2,672 1055 2.86 100% 100% 100% 99%
n-body
source secs mem gz busy cpu load
C gcc 2.18 768 1633 2.19 0% 100% 0% 0%
Rust 3.29 1,196 1753 3.33 0% 100% 1% 0%
pidigits
source secs mem gz busy cpu load
C gcc 0.59 2,444 1090 2.37 100% 100% 100% 98%
Rust 0.71 3,044 799 0.73 1% 0% 1% 100%
fannkuch-redux
source secs mem gz busy cpu load
C gcc 7.58 872 910 29.61 100% 98% 99% 93%
Rust 7.54 1,200 1020 29.78 97% 100% 99% 99%
fasta
source secs mem gz busy cpu load
C gcc 0.78 1,156 1463 0.78 0% 0% 0% 100%
Rust 0.77 1,840 2529 1.59 66% 100% 4% 38%
regex-redux
source secs mem gz busy cpu load
C gcc 0.80 152,172 1397 2.01 52% 99% 48% 53%
Rust 0.77 147,524 2458 1.99 54% 59% 91% 54%
mandelbrot
source secs mem gz busy cpu load
C gcc 1.27 31,792 1135 5.08 100% 100% 99% 100%
Rust 0.93 32,676 763 3.70 100% 99% 100% 100%
k-nucleotide
source secs mem gz busy cpu load
C gcc 3.72 130,260 1506 12.07 100% 89% 78% 57%
Rust 2.70 159,048 1691 10.08 93% 92% 91% 99%
binary-trees
source secs mem gz busy cpu load
C gcc 1.54 168,832 809 4.35 60% 67% 57% 100%
Rust 1.09 198,728 765 3.90 87% 98% 88% 86%
reverse-complement
source secs mem gz busy cpu load
C gcc 0.86 712,208 820 1.27 99% 28% 1% 19%
Rust 0.45 498,964 3040 0.77 25% 23% 100% 25%
C gcc

gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0

Rust

rustc 1.55.0 (c8dfcfe04 2021-09-06)
LLVM version: 12.0.1