The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Swift versus Go

Always look at the source code.

If the fastest programs are hand-written vector instructions, does the host language matter? You might be more interested in the less optimised programs — more cpu seconds, less gz source code.

fannkuch-redux
source mem gz cpu
Swift #3 6,644 1097 31.59
Go #3 2,260 969 32.88
Swift 6,456 451 35.27
Go 2,956 900 47.36
Go #2 11,316 896 47.56
n-body
source mem gz cpu
Swift #4 14,076 1355 5.28
Swift #5 10,800 1365 5.29
Swift #7 14,024 1326 5.33
Swift #8 14,028 1681 5.70
Swift #6 6,356 1194 6.11
Go #3 1,136 1200 6.38
Go 1,136 1310 6.58
Go #2 1,132 1215 6.94
Swift #3 6,452 1204 8.11
Swift #2 6,420 1192 8.68
Swift #9 14,032 1526 292.55
spectral-norm
source mem gz cpu
Swift 12,872 438 5.32
Go 2,452 411 5.33
Go #4 1,952 548 5.67
Go #2 1,420 668 5.68
Swift #3 6,876 601 5.68
mandelbrot
source mem gz cpu
Swift #7 41,804 1140 5.29
Swift #6 44,504 1141 5.43
Go #4 33,812 905 14.85
Go #3 34,028 894 14.91
Go 32,600 823 19.58
Swift 6,484 394 26.22
Swift #5 41,620 659 26.91
Go #2 33,196 837 27.07
Go #6 32,764 700 27.25
Swift #3   Bad Output  
pidigits
source mem gz cpu
Swift #2 8,132 600 0.74
Go #4 8,732 683 0.87
Go #3 9,320 603 1.18
Go 9,496 708 1.21
Go #2 9,032 733 1.59
Go #8 9,924 720 2.54
Go #7 8,620 696 5.05
regex-redux
source mem gz cpu
Go #5 306,476 810 5.97
Go #4 355,844 829 34.99
Swift #2 682,836 671 43.47
Swift 879,156 715 44.12
Swift #4 1,061,888 745 45.38
Go #3 358,472 829 67.28
Go 297,048 741 68.45
fasta
source mem gz cpu
Swift #2 7,440 1945 3.17
Go 1,112 1053 3.64
Go #2 10,980 1404 3.84
Go #3 3,168 1358 3.98
Swift 6,908 1526 4.52
Swift #3 26,916 2090 4.64
k-nucleotide
source mem gz cpu
Go #7 159,432 1607 28.49
Go #6 149,712 1590 29.40
Go #4 144,528 1543 30.22
Go #3 149,984 1722 30.25
Swift #2 257,052 1367 52.46
Swift   Make Error  
reverse-complement
source mem gz cpu
Go #2 826,796 611 1.94
Go #3 826,544 605 2.13
Swift 794,484 1286 2.26
Go #5 1,483,756 996 2.26
Go #6 1,289,572 1338 2.48
Go   Failed  
binary-trees
source mem gz cpu
Go #6 411,424 611 29.23
Swift #5 733,388 806 41.37
Swift #3 700,092 862 43.45
Swift #2 699,876 816 44.09
Go #2 632,396 666 48.67
Go #3 328,700 799 50.09
Go #5 394,800 950 50.52
Go 240,292 482 51.02
Go #7 259,088 525 51.41
Swift 733,908 714 59.11
Swift #4 700,512 765 60.93
Swift #9   Make Error  
Swift

Swift version 5.7-dev
(LLVM a177fc627109410,
Swift 31967c6df177cce)

Go

go version go1.18 linux/amd64