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,668 1097 29.52 98% 100% 99% 100%
C gcc 7.52 836 910 29.37 99% 100% 93% 99%
pidigits
source secs mem gz busy cpu load
Swift 0.76 8,428 600 0.82 100% 3% 1% 4%
C gcc 0.73 2,848 416 0.75 1% 100% 1% 0%
n-body
source secs mem gz busy cpu load
Swift 4.89 10,240 1326 4.95 0% 100% 1% 0%
C gcc 4.30 8 1391 4.32 0% 0% 0% 100%
mandelbrot
source secs mem gz busy cpu load
Swift 1.87 39,072 1138 7.44 100% 99% 98% 99%
C gcc 1.27 31,692 1135 5.08 100% 100% 100% 99%
fasta
source secs mem gz busy cpu load
Swift 1.51 26,104 2090 4.81 91% 76% 77% 74%
C gcc 0.82 2,896 2268 3.26 99% 100% 100% 99%
spectral-norm
source secs mem gz busy cpu load
Swift 1.44 7,960 601 5.73 100% 99% 100% 99%
C gcc 0.72 1,100 569 2.86 100% 99% 100% 100%
reverse-complement
source secs mem gz busy cpu load
Swift 1.79 788,908 1286 2.25 74% 19% 2% 30%
C gcc 0.86 698,264 820 1.27 1% 18% 100% 28%
k-nucleotide
source secs mem gz busy cpu load
Swift 14.26 256,316 1367 54.61 97% 95% 95% 96%
C gcc 3.81 130,112 1506 12.18 54% 87% 79% 100%
binary-trees
source secs mem gz busy cpu load
Swift 16.00 699,652 862 50.97 100% 65% 76% 78%
C gcc 1.79 168,760 809 5.35 64% 64% 71% 100%
regex-redux
source secs mem gz busy cpu load
Swift 24.30 1,060,320 745 50.20 44% 92% 35% 35%
C gcc 0.80 152,196 1397 2.03 48% 100% 54% 53%
Swift

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

C gcc

gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0