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.89 8,484 600 0.90 0% 100% 1% 0%
Rust 0.88 2,884 1306 0.89 1% 0% 0% 100%
fannkuch-redux
source secs mem gz busy cpu load
Swift 7.46 7,512 1097 29.57 100% 98% 98% 100%
Rust 6.87 1,016 1016 26.97 100% 99% 94% 100%
fasta
source secs mem gz busy cpu load
Swift 1.41 26,372 2090 4.66 76% 96% 80% 78%
Rust 0.93 2,180 1906 3.08 80% 89% 81% 81%
n-body
source secs mem gz busy cpu load
Swift 5.33 12,352 1355 5.52 100% 1% 1% 1%
Rust 3.33 688 1753 3.42 0% 100% 2% 1%
mandelbrot
source secs mem gz busy cpu load
Swift 1.77 39,044 1138 7.00 99% 100% 99% 99%
Rust 0.94 26,316 719 3.71 99% 98% 100% 98%
spectral-norm
source secs mem gz busy cpu load
Swift 1.44 7,932 601 5.72 99% 100% 99% 99%
Rust 0.71 2,436 1126 2.86 100% 100% 100% 100%
reverse-complement
source secs mem gz busy cpu load
Swift 1.78 733,260 1286 2.35 1% 53% 74% 4%
Rust 0.74 994,956 1330 1.36 47% 59% 49% 28%
k-nucleotide
source secs mem gz busy cpu load
Swift 14.10 185,448 1367 54.12 98% 95% 96% 96%
Rust 2.76 132,424 1578 9.03 69% 100% 67% 91%
binary-trees
source secs mem gz busy cpu load
Swift 15.93 701,592 862 50.78 79% 100% 65% 75%
Rust 1.30 111,692 721 4.69 99% 86% 86% 88%
regex-redux
source secs mem gz busy cpu load
Swift 26.88 878,976 715 52.04 18% 83% 2% 91%
Rust 1.28 153,836 986 1.79 13% 83% 13% 31%
Swift

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

Rust

rustc 1.44.1 (c7087fe00 2020-06-17)
LLVM version: 9.0