The Computer Language
Benchmarks Game

Rust versus C gcc 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.

reverse-complement
source secs mem gz busy cpu load
Rust 0.45 499,076 3040 0.95 24% 100% 24% 62%
C gcc 0.86 712,208 820 1.27 99% 28% 1% 19%
binary-trees
source secs mem gz busy cpu load
Rust 1.08 198,580 765 3.81 85% 99% 86% 84%
C gcc 1.54 168,832 809 4.35 60% 67% 57% 100%
k-nucleotide
source secs mem gz busy cpu load
Rust 2.68 159,112 1691 10.01 99% 91% 92% 92%
C gcc 3.72 130,260 1506 12.07 100% 89% 78% 57%
mandelbrot
source secs mem gz busy cpu load
Rust 0.93 32,644 763 3.71 100% 100% 100% 100%
C gcc 1.27 31,792 1135 5.08 100% 100% 99% 100%
pidigits
source secs mem gz busy cpu load
Rust 0.71 2,644 799 0.72 0% 0% 100% 1%
C gcc 0.81 2,804 416 0.84 1% 2% 99% 1%
regex-redux
source secs mem gz busy cpu load
Rust 0.77 145,284 2458 1.98 53% 90% 53% 60%
C gcc 0.80 152,172 1397 2.01 52% 99% 48% 53%
fasta
source secs mem gz busy cpu load
Rust 0.77 1,816 2529 1.53 99% 1% 0% 99%
C gcc 0.78 1,156 1463 0.78 0% 0% 0% 100%
fannkuch-redux
source secs mem gz busy cpu load
Rust 7.53 1,172 1020 29.57 99% 98% 100% 95%
C gcc 7.58 872 910 29.61 100% 98% 99% 93%
n-body
source secs mem gz busy cpu load
Rust 3.42 840 1753 4.20 100% 16% 4% 4%
C gcc 2.18 768 1633 2.19 0% 100% 0% 0%
spectral-norm
source secs mem gz busy cpu load
Rust 0.71 2,568 1055 2.84 100% 99% 99% 100%
C gcc 0.40 872 1197 1.58 100% 100% 100% 98%
Rust

rustc 1.52.0 (88f19c6da 2021-05-03)
LLVM version: 12.0.0

C gcc

gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0