The Computer Language
24.04 Benchmarks Game

Go versus Python 3 fastest performance

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
Go #3 8.33 19,664 975 33.25
Go 11.74 19,664 906 46.77
Go #2 11.79 19,664 903 46.97
Python 3 #6 1,031.38 19,652 391 1,031.34
Python 3 #4 300.68 19,652 960 1,189.39
n-body
source secs mem gz cpu secs
Go #3 6.37 19,808 1207 6.38
Go 7.00 19,680 1316 7.02
Go #2 7.02 19,680 1222 7.03
Python 3 #2 362.72 19,656 1247 362.70
Python 3 368.32 19,656 1201 368.30
spectral-norm
source secs mem gz cpu secs
Go 5.32 19,824 417 5.33
Go #2 1.53 19,824 674 5.67
Go #4 1.44 19,824 555 5.67
Python 3 #7 90.77 19,656 425 359.32
Python 3 #6 359.89 19,656 334 359.83
Python 3 #8 98.97 19,656 415 386.79
mandelbrot
source secs mem gz cpu secs
Go #4 3.76 35,328 912 14.92
Go #3 3.76 35,456 900 14.94
Go 5.01 33,408 829 19.98
Go #2 6.85 33,152 843 27.29
Go #6 6.89 32,768 707 27.40
Python 3 #7 159.49 19,656 698 634.00
Python 3 #3 820.95 19,624 319 820.91
Python 3 #2 232.82 156,340 790 880.90
Python 3 #5 274.66 19,628 463 1,094.30
pidigits
source secs mem gz cpu secs
Go #4 0.95 19,808 689 0.97
Python 3 #3 1.31 19,784 573 1.31
Go 1.35 19,696 715 1.37
Go #3 1.58 19,824 610 1.62
Go #2 2.13 19,824 740 2.19
Go #8 2.49 19,696 727 2.50
Python 3 #4 4.73 19,656 348 4.73
Go #7 5.12 19,824 702 5.88
Python 3 #5   Failed  
regex-redux
source secs mem gz cpu secs
Python 3 #2 1.35 168,092 1411 2.62
Go #5 3.17 320,972 817 5.38
Python 3 8.83 432,724 515 16.44
Go #4 14.51 368,680 832 34.26
Go 25.58 345,472 749 61.95
Go #3 25.72 402,968 836 62.19
fasta
source secs mem gz cpu secs
Go 3.73 19,804 1055 3.74
Go #2 1.26 19,672 1405 4.03
Go #3 1.50 19,664 1362 4.08
Python 3 #2 38.53 19,652 1126 38.53
Python 3 #3 38.86 19,780 1007 38.86
Python 3 #5 26.54 827,148 1951 53.26
Python 3 60.37 19,652 823 60.37
k-nucleotide
source secs mem gz cpu secs
Go #7 7.52 162,944 1613 28.68
Go #6 8.17 145,152 1596 29.90
Go #3 8.38 145,152 1729 30.32
Go #4 9.07 139,904 1552 30.33
Python 3 #3 48.64 262,016 1970 184.81
Python 3 #8 87.79 506,880 663 262.44
Python 3 #9 77.06 380,416 614 263.65
Python 3 275.64 500,224 499 274.74
reverse-complement
source secs mem gz cpu secs
Go #2 2.21 802,176 614 2.30
Go #3 2.47 802,048 609 2.56
Go #6 1.84 1,249,840 1340 3.30
Python 3 #3 5.18 509,108 803 5.18
Python 3 #5 4.07 1,500,240 960 7.41
Python 3 #2 10.46 1,788,876 440 10.46
Python 3 10.69 1,987,304 484 10.69
Python 3 #6 7.86 2,484,084 821 11.49
Python 3 #4 13.91 4,003,712 343 13.91
Go #5   Bad Output  
Go   Failed  
binary-trees
source secs mem gz cpu secs
Go #6 27.61 404,608 618 29.03
Go #2 13.87 601,252 672 55.04
Go #5 14.37 308,092 957 56.80
Go #3 14.86 323,544 806 57.39
Go 30.97 262,396 488 57.95
Go #7 33.10 292,588 531 61.68
Python 3 #2 110.47 273,024 344 110.46
Python 3 #4 34.53 277,632 481 126.59
Python 3 #5 35.74 275,456 669 127.53
Python 3 36.16 277,760 597 128.12
Python 3 #3 55.05 672,384 1247 158.56
Go

go version go1.22.0 linux/amd64
GOAMD64=v2

Python 3

Python 3.12.2