Swift versus Go fastest performance
How the programs are written matters! 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 seconds, less gz source code.
fannkuch-redux | ||||
---|---|---|---|---|
source | secs | mem | gz | cpu secs |
* Swift #3 | 8.32 | 19,440 | 1103 | 32.99 |
Go #3 | 8.34 | 19,808 | 975 | 33.31 |
Swift #8 | 35.13 | 19,444 | 470 | 35.12 |
Go #8 | 46.13 | 19,440 | 500 | 46.24 |
Go | 12.29 | 19,808 | 906 | 49.04 |
Go #2 | 12.35 | 19,808 | 903 | 49.32 |
n-body | ||||
source | secs | mem | gz | cpu secs |
* Swift #3 | 5.43 | 19,440 | 1688 | 5.43 |
* Swift #4 | 5.46 | 19,440 | 1361 | 5.46 |
* Swift #5 | 5.49 | 19,440 | 1372 | 5.49 |
* Swift #7 | 5.50 | 19,440 | 1333 | 5.50 |
Swift #6 | 5.78 | 19,440 | 1213 | 5.78 |
Go #3 | 6.38 | 19,808 | 1207 | 6.40 |
Swift #8 | 6.65 | 19,440 | 1285 | 6.65 |
Go | 7.01 | 19,808 | 1316 | 7.03 |
Go #2 | 7.03 | 19,808 | 1222 | 7.05 |
Swift | 7.85 | 19,440 | 1210 | 7.85 |
Go #8 | 9.60 | 19,436 | 1224 | 9.62 |
Swift #9 | 288.23 | 19,440 | 1532 | 288.20 |
spectral-norm | ||||
source | secs | mem | gz | cpu secs |
Swift #8 | 5.33 | 19,568 | 411 | 5.33 |
Go #8 | 5.33 | 19,416 | 429 | 5.34 |
Go | 5.33 | 19,808 | 417 | 5.34 |
Go #2 | 1.50 | 19,808 | 674 | 5.68 |
Go #4 | 1.45 | 19,808 | 555 | 5.69 |
Swift #3 | 1.43 | 19,440 | 607 | 5.69 |
mandelbrot | ||||
source | secs | mem | gz | cpu secs |
* Swift #7 | 1.38 | 49,024 | 1147 | 5.49 |
* Swift #6 | 1.46 | 51,840 | 1147 | 5.78 |
Go #4 | 3.76 | 35,456 | 912 | 14.99 |
Go #3 | 3.77 | 35,456 | 900 | 15.00 |
Go | 5.02 | 33,024 | 829 | 20.02 |
Swift #8 | 25.59 | 19,492 | 426 | 25.59 |
Swift | 26.45 | 19,440 | 400 | 26.45 |
Go #8 | 26.68 | 19,440 | 500 | 26.74 |
Swift #5 | 7.25 | 43,648 | 665 | 27.03 |
Go #2 | 6.85 | 33,152 | 843 | 27.28 |
Go #6 | 6.89 | 33,024 | 707 | 27.44 |
* Swift #3 | ||||
fasta | ||||
source | secs | mem | gz | cpu secs |
Go | 3.73 | 19,808 | 1055 | 3.74 |
* Swift #2 | 2.11 | 19,440 | 1952 | 3.76 |
Go #2 | 1.27 | 19,808 | 1405 | 4.06 |
Go #3 | 1.51 | 19,808 | 1362 | 4.09 |
* Swift | 5.15 | 19,440 | 1533 | 5.14 |
* Swift #3 | 2.18 | 31,248 | 2097 | 5.40 |
Go #8 | 11.46 | 19,820 | 880 | 11.55 |
Swift #8 | 18.86 | 19,972 | 828 | 18.86 |
k-nucleotide | ||||
source | secs | mem | gz | cpu secs |
Go #7 | 7.63 | 163,072 | 1613 | 28.79 |
Go #3 | 8.18 | 145,280 | 1729 | 29.88 |
Go #6 | 8.21 | 145,152 | 1596 | 30.01 |
Go #4 | 9.16 | 140,032 | 1552 | 31.38 |
* Swift #2 | 14.54 | 260,820 | 1373 | 55.20 |
Go #8 | 61.96 | 537,908 | 752 | 62.57 |
Swift #8 | 181.50 | 627,328 | 658 | 180.87 |
Swift #7 | 233.16 | 627,092 | 607 | 232.52 |
Swift | ||||
reverse-complement | ||||
source | secs | mem | gz | cpu secs |
Go #2 | 2.19 | 800,640 | 614 | 2.29 |
* Swift | 1.95 | 798,228 | 1293 | 2.39 |
Go #3 | 2.48 | 800,384 | 609 | 2.57 |
Go #6 | 1.91 | 1,244,508 | 1340 | 3.40 |
Go #5 | ||||
Go | ||||
binary-trees | ||||
source | secs | mem | gz | cpu secs |
Go #6 | 27.90 | 404,096 | 618 | 29.26 |
Swift | 18.28 | 737,152 | 720 | 54.20 |
Swift #8 | 54.90 | 402,048 | 567 | 54.89 |
Swift #4 | 17.49 | 707,456 | 772 | 55.84 |
Swift #5 | 18.89 | 738,048 | 813 | 56.25 |
Go #2 | 14.17 | 624,780 | 672 | 56.29 |
Go #3 | 14.91 | 326,508 | 806 | 58.00 |
Go #5 | 14.87 | 425,960 | 957 | 58.15 |
Swift #2 | 18.29 | 707,456 | 822 | 58.16 |
Swift #3 | 18.18 | 707,584 | 868 | 58.24 |
Go | 32.01 | 243,192 | 488 | 59.78 |
Go #7 | 32.52 | 248,604 | 531 | 61.47 |
* Swift #9 | ||||
pidigits | ||||
source | secs | mem | gz | cpu secs |
* Swift #2 | 0.75 | 19,440 | 606 | 0.75 |
* Go #4 | 0.82 | 19,808 | 689 | 0.83 |
Go | 1.18 | 19,808 | 715 | 1.20 |
* Go #3 | 1.40 | 19,808 | 610 | 1.44 |
Go #2 | 1.84 | 19,808 | 740 | 1.89 |
Go #6 | 2.46 | 19,512 | 727 | 2.46 |
Go #7 | 4.99 | 19,808 | 702 | 5.61 |
regex-redux | ||||
source | secs | mem | gz | cpu secs |
Go #5 | 3.25 | 321,360 | 817 | 5.43 |
Go #4 | 14.61 | 369,008 | 832 | 35.91 |
Swift #2 | 38.80 | 686,136 | 678 | 38.80 |
Swift | 23.40 | 891,792 | 721 | 39.65 |
Swift #4 | 18.30 | 1,064,768 | 751 | 41.36 |
Go | 25.37 | 319,956 | 749 | 61.07 |
Go #3 | 25.62 | 371,204 | 836 | 61.79 |
Swift | ||||
Go |