The Computer Language
Benchmarks Game

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

k-nucleotide
source secs mem gz busy cpu load
Rust 2.81 131,400 1578 8.83 86% 73% 90% 64%
C clang 6.19 128,848 1506 12.79 30% 42% 42% 92%
mandelbrot
source secs mem gz busy cpu load
Rust 1.19 30,608 719 4.72 98% 98% 99% 100%
C clang 2.09 26,300 694 8.32 100% 100% 100% 100%
binary-trees
source secs mem gz busy cpu load
Rust 1.20 111,528 721 4.32 87% 87% 86% 99%
C clang 1.93 169,400 809 6.19 72% 79% 70% 100%
reverse-complement
source secs mem gz busy cpu load
Rust 0.75 994,900 1330 1.37 28% 27% 46% 81%
C clang 0.98 585,620 820 3.92 100% 100% 100% 99%
fannkuch-redux
source secs mem gz busy cpu load
Rust 7.29 1,016 1020 28.68 100% 100% 99% 95%
C clang 9.45 760 1557 36.57 90% 98% 100% 99%
spectral-norm
source secs mem gz busy cpu load
Rust 0.71 2,468 817 2.83 100% 99% 99% 99%
C clang 0.72 3,140 569 2.87 100% 100% 100% 100%
n-body
source secs mem gz busy cpu load
Rust 3.43 692 1753 3.44 100% 1% 0% 0%
C clang 3.31 8 1391 3.32 0% 100% 0% 0%
fasta
source secs mem gz busy cpu load
Rust 0.93 2,180 1961 3.13 90% 82% 83% 83%
C clang 0.88 3,904 2011 3.44 98% 100% 97% 97%
pidigits
source secs mem gz busy cpu load
Rust 0.88 2,928 1420 0.89 100% 1% 0% 0%
C clang 0.81 2,544 416 0.84 0% 100% 0% 4%
regex-redux
source secs mem gz busy cpu load
Rust 1.30 153,268 986 1.80 12% 28% 83% 15%
C clang 0.81 154,176 1397 2.79 77% 83% 85% 99%
Rust

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

C clang

clang version 10.0.0-4ubuntu1