The Computer Language
Benchmarks Game

Swift programs versus C gcc

by benchmark task performance

pidigits
source secs mem gz cpu cpu load
Swift 1.75 8,128 601 1.74 1% 0% 100% 1%
C gcc 1.73 2,116 448 1.73 1% 99% 1% 0%
fannkuch-redux
source secs mem gz cpu cpu load
Swift 10.34 9,656 1102 40.92 100% 100% 98% 98%
C gcc 8.97 1,660 910 35.00 98% 94% 99% 100%
fasta
source secs mem gz cpu cpu load
Swift 2.36 37,188 2096 7.26 89% 82% 73% 66%
C gcc 1.33 2,856 2249 5.28 100% 99% 100% 99%
spectral-norm
source secs mem gz cpu cpu load
Swift 3.99 13,404 601 15.82 99% 100% 99% 99%
C gcc 1.99 1,824 1139 7.88 99% 99% 99% 100%
mandelbrot
source secs mem gz cpu cpu load
Swift 3.32 41,236 1136 13.17 99% 99% 99% 100%
C gcc 1.65 32,684 1135 6.53 99% 99% 100% 99%
reverse-complement
source secs mem gz cpu cpu load
Swift 0.85 273,548 1287 1.03 10% 13% 80% 22%
C gcc 0.42 143,948 812 0.58 15% 26% 98% 2%
binary-trees
source secs mem gz cpu cpu load
Swift 4.88 192,428 997 13.77 91% 61% 69% 63%
C gcc 2.38 131,728 836 7.70 98% 87% 73% 68%
n-body
source secs mem gz cpu cpu load
Swift 23.62 7,256 1253 23.61 1% 1% 100% 0%
C gcc 9.96 1,016 1490 9.95 1% 1% 1% 100%
k-nucleotide
source secs mem gz cpu cpu load
Swift 20.64 264,112 1366 76.31 93% 90% 96% 92%
C gcc 5.38 129,772 1499 16.37 61% 82% 89% 74%
regex-redux
source secs mem gz cpu cpu load
Swift 101.01 695,648 671 100.95 84% 17% 1% 0%
C gcc 1.45 155,768 1230 4.03 61% 64% 56% 100%
Swift

Swift version 3.1-dev (LLVM 90ddc086b8, Clang 38e310f953, Swift 66d9533723)
Target: x86_64-unknown-linux-gnu

C gcc

gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406