The Computer Language
Benchmarks Game

Swift versus C gcc 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.

fannkuch-redux
source secs mem gz busy cpu load
Swift 7.46 7,512 1097 29.57 100% 98% 98% 100%
C gcc 7.45 692 910 29.11 93% 100% 100% 98%
pidigits
source secs mem gz busy cpu load
Swift 0.89 8,484 600 0.90 0% 100% 1% 0%
C gcc 0.81 2,664 416 0.84 1% 0% 100% 2%
n-body
source secs mem gz busy cpu load
Swift 5.33 12,352 1355 5.52 100% 1% 1% 1%
C gcc 4.25 8 1391 4.37 100% 0% 2% 0%
mandelbrot
source secs mem gz busy cpu load
Swift 1.77 39,044 1138 7.00 99% 100% 99% 99%
C gcc 1.26 24,836 1135 5.00 99% 100% 100% 99%
fasta
source secs mem gz busy cpu load
Swift 1.41 26,372 2090 4.66 76% 96% 80% 78%
C gcc 0.82 2,888 2268 3.27 100% 99% 100% 100%
spectral-norm
source secs mem gz busy cpu load
Swift 1.44 7,932 601 5.72 99% 100% 99% 99%
C gcc 0.72 1,020 569 2.87 100% 100% 100% 99%
reverse-complement
source secs mem gz busy cpu load
Swift 1.78 733,260 1286 2.35 1% 53% 74% 4%
C gcc 0.86 624,308 820 1.23 27% 18% 99% 0%
k-nucleotide
source secs mem gz busy cpu load
Swift 14.10 185,448 1367 54.12 98% 95% 96% 96%
C gcc 3.43 130,252 1506 11.17 90% 92% 88% 56%
binary-trees
source secs mem gz busy cpu load
Swift 15.93 701,592 862 50.78 79% 100% 65% 75%
C gcc 1.96 103,240 836 5.52 100% 65% 59% 58%
regex-redux
source secs mem gz busy cpu load
Swift 26.88 878,976 715 52.04 18% 83% 2% 91%
C gcc 0.80 148,844 1397 2.03 53% 100% 54% 48%
Swift

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

C gcc

gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0