The Computer Language
Benchmarks Game

Swift programs versus Rust

by benchmark task performance

fannkuch-redux
source secs mem gz cpu cpu load
Swift 10.16 9,720 1102 40.22 100% 100% 98% 98%
Rust 10.82 18,084 1020 42.18 99% 100% 93% 98%
pidigits
source secs mem gz cpu cpu load
Swift 1.75 8,488 601 1.75 0% 100% 1% 1%
Rust 1.74 7,892 1420 1.74 0% 1% 100% 2%
binary-trees
source secs mem gz cpu cpu load
Swift 4.97 194,028 997 13.96 60% 63% 100% 60%
Rust 4.43 196,468 717 16.56 92% 92% 100% 93%
fasta
source secs mem gz cpu cpu load
Swift 2.43 34,100 2096 7.86 83% 80% 75% 90%
Rust 1.48 18,524 1887 4.56 83% 76% 76% 75%
n-body
source secs mem gz cpu cpu load
Swift 21.96 7,372 1253 21.95 1% 100% 0% 0%
Rust 13.08 5,704 1540 13.08 0% 1% 1% 100%
spectral-norm
source secs mem gz cpu cpu load
Swift 3.97 13,504 601 15.81 100% 100% 100% 100%
Rust 2.34 20,064 817 9.27 100% 100% 100% 100%
mandelbrot
source secs mem gz cpu cpu load
Swift 3.32 43,356 1136 13.19 100% 99% 99% 99%
Rust 1.93 52,796 1160 7.65 100% 99% 100% 99%
reverse-complement
source secs mem gz cpu cpu load
Swift 0.86 209,884 1287 1.03 80% 42% 1% 1%
Rust 0.33 268,344 1324 0.61 34% 100% 31% 28%
k-nucleotide
source secs mem gz cpu cpu load
Swift 20.43 243,712 1366 76.16 94% 92% 92% 97%
Rust 5.27 156,408 1728 17.06 77% 91% 68% 91%
regex-redux
source secs mem gz cpu cpu load
Swift 104.62 695,700 671 104.56 100% 2% 1% 0%
Rust 2.83 179,428 804 4.22 88% 17% 17% 29%
Swift

Swift version 4.0-dev (LLVM 7d1af4e028, Clang 14f7ac7518, Swift 52fcadf409)
Target: x86_64-unknown-linux-gnu

Rust

rustc 1.18.0 (03fc9d622 2017-06-06)