The Computer Language
Benchmarks Game

Swift 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.

pidigits
source secs mem gz busy cpu load
Swift 0.76 8,428 600 0.82 100% 3% 1% 4%
Rust 0.74 2,888 1420 0.76 0% 0% 100% 3%
fannkuch-redux
source secs mem gz busy cpu load
Swift 7.46 7,668 1097 29.52 98% 100% 99% 100%
Rust 7.28 1,168 1016 28.82 100% 97% 100% 100%
n-body
source secs mem gz busy cpu load
Swift 4.89 10,240 1326 4.95 0% 100% 1% 0%
Rust 3.31 836 1767 3.36 100% 1% 0% 1%
fasta
source secs mem gz busy cpu load
Swift 1.51 26,104 2090 4.81 91% 76% 77% 74%
Rust 0.77 1,848 2529 1.57 99% 1% 4% 100%
spectral-norm
source secs mem gz busy cpu load
Swift 1.44 7,960 601 5.73 100% 99% 100% 99%
Rust 0.71 2,696 1055 2.86 100% 100% 100% 100%
mandelbrot
source secs mem gz busy cpu load
Swift 1.87 39,072 1138 7.44 100% 99% 98% 99%
Rust 0.93 32,788 763 3.69 100% 100% 99% 100%
reverse-complement
source secs mem gz busy cpu load
Swift 1.79 788,908 1286 2.25 74% 19% 2% 30%
Rust 0.46 499,024 3040 0.83 26% 80% 47% 28%
k-nucleotide
source secs mem gz busy cpu load
Swift 14.26 256,316 1367 54.61 97% 95% 95% 96%
Rust 2.76 159,224 1691 10.20 90% 98% 91% 90%
binary-trees
source secs mem gz busy cpu load
Swift 16.00 699,652 862 50.97 100% 65% 76% 78%
Rust 1.07 198,540 765 3.76 84% 100% 84% 83%
regex-redux
source secs mem gz busy cpu load
Swift 24.30 1,060,320 745 50.20 44% 92% 35% 35%
Rust 0.78 146,236 2458 1.99 53% 53% 61% 90%
Swift

Swift version 5.3 (swift-5.3-RELEASE)
Target: x86_64-unknown-linux-gnu

Rust

rustc 1.48.0 (7eac88abb 2020-11-16)
LLVM version: 11.0