The Computer Language
Benchmarks Game

Swift versus Go fastest programs

Always look at the source code.

These are only the fastest programs. Do some of them use manually vectorized SIMD? Look at the other programs. They may seem more-like a fair comparison to you.

mandelbrot
source secs mem gz busy cpu load
Swift 1.34 41,120 1140 5.34 99% 99% 100% 100%
Go 3.73 34,192 905 14.85 99% 99% 99% 100%
n-body
source secs mem gz busy cpu load
Swift 5.32 10,456 1365 5.37 100% 0% 0% 0%
Go 6.38 1,604 1200 6.42 0% 100% 0% 0%
pidigits
source secs mem gz busy cpu load
Swift 0.89 9,256 600 0.91 3% 0% 0% 99%
Go 1.00 8,808 683 1.03 2% 1% 45% 55%
fannkuch-redux
source secs mem gz busy cpu load
Swift 8.24 7,824 1097 32.69 98% 99% 100% 100%
Go 8.31 2,316 969 33.23 100% 100% 100% 100%
spectral-norm
source secs mem gz busy cpu load
Swift 1.43 8,144 601 5.68 100% 99% 99% 99%
Go 1.43 2,208 548 5.68 99% 99% 100% 99%
fasta
source secs mem gz busy cpu load
Swift 1.41 26,396 2090 4.73 80% 80% 96% 79%
Go 1.26 11,480 1404 3.89 79% 89% 70% 71%
binary-trees
source secs mem gz busy cpu load
Swift 16.15 699,872 862 51.81 77% 66% 79% 100%
Go 12.23 392,744 1017 41.62 83% 87% 85% 85%
reverse-complement
source secs mem gz busy cpu load
Swift 1.81 781,992 1286 2.28 3% 0% 48% 75%
Go 1.35 1,560,228 996 2.24 24% 35% 10% 99%
k-nucleotide
source secs mem gz busy cpu load
Swift 13.56 256,964 1367 52.30 96% 95% 96% 99%
Go 7.46 160,328 1607 28.71 98% 95% 95% 97%
regex-redux
source secs mem gz busy cpu load
Swift 23.14 1,059,096 745 48.76 92% 37% 46% 36%
Go 3.85 324,200 810 6.01 27% 19% 20% 91%
Swift

Swift version 5.5-dev (LLVM f9e846e117057c8, Swift a58e8c181f2e258)
Target: x86_64-unknown-linux-gnu

Go

go version go1.17 linux/amd64