The Computer Language
Benchmarks Game

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

binary-trees
source secs mem gz busy cpu load
Rust 1.02 198,720 765 3.64 87% 86% 85% 99%
C clang 7.69 351,340 908 27.75 92% 91% 88% 91%
regex-redux
source secs mem gz busy cpu load
Rust 0.77 147,384 2458 2.00 55% 59% 55% 91%
C clang 3.12 103,044 1115 3.14 100% 0% 1% 0%
mandelbrot
source secs mem gz busy cpu load
Rust 0.93 32,648 763 3.70 99% 100% 100% 100%
C clang 3.49 29,608 822 13.94 100% 100% 100% 100%
reverse-complement
source secs mem gz busy cpu load
Rust 0.45 498,880 3040 0.76 61% 23% 60% 24%
C clang 1.07 994,176 750 1.55 15% 88% 12% 30%
fannkuch-redux
source secs mem gz busy cpu load
Rust 7.61 1,200 1020 29.86 94% 100% 99% 99%
C clang 8.85 936 1557 34.65 94% 100% 98% 99%
fasta
source secs mem gz busy cpu load
Rust 0.76 1,836 2529 1.53 99% 63% 38% 0%
C clang 0.78 1,160 1463 0.79 0% 1% 100% 0%
pidigits
source secs mem gz busy cpu load
Rust 0.72 2,660 799 0.77 100% 0% 0% 7%
C clang 0.61 2,340 1090 2.41 100% 98% 100% 100%
n-body
source secs mem gz busy cpu load
Rust 3.42 872 1753 3.44 0% 100% 0% 0%
C clang 2.21 768 1633 2.23 0% 0% 0% 100%
spectral-norm
source secs mem gz busy cpu load
Rust 0.71 2,660 817 2.86 100% 100% 100% 100%
C clang   Make Error
k-nucleotide
source secs mem gz busy cpu load
Rust 2.68 159,104 1691 10.03 92% 91% 100% 91%
C clang   Make Error
Rust

rustc 1.53.0 (53cb7b09b 2021-06-17)
LLVM version: 12.0.1

C clang

Ubuntu clang version 12.0.0-1ubuntu