The Computer Language
24.09 Benchmarks Game

Python 3 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
Go #3 8.34 19,808 975 33.31
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
Python 3 #6 1,033.31 19,312 391 1,033.27
Python 3 #4 302.37 19,312 960 1,196.45
Python 3 #8 2,259.59 19,312 414 2,259.50
n-body
source secs mem gz cpu secs
Go #3 6.38 19,808 1207 6.40
Go 7.01 19,808 1316 7.03
Go #2 7.03 19,808 1222 7.05
Go #8 9.60 19,436 1224 9.62
Python 3 355.06 19,312 1201 355.05
Python 3 #2 374.16 19,312 1247 374.14
Python 3 #8 518.11 19,312 1172 518.09
spectral-norm
source secs mem gz cpu secs
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
Python 3 #6 347.53 19,316 334 347.52
Python 3 #4 90.52 19,308 415 359.95
Python 3 #8 379.97 19,440 334 379.96
Python 3 #7 97.11 19,316 425 380.79
mandelbrot
source secs mem gz cpu secs
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
Go #8 26.68 19,440 500 26.74
Go #2 6.85 33,152 843 27.28
Go #6 6.89 33,024 707 27.44
Python 3 #7 172.20 19,312 698 687.68
Python 3 #3 861.76 19,312 319 861.73
Python 3 #2 235.71 95,164 790 926.30
Python 3 #5 257.00 19,312 463 1,026.96
pidigits
source secs mem gz cpu secs
Go #4 0.82 19,808 689 0.83
Go 1.18 19,808 715 1.20
Python 3 #3 1.26 19,312 573 1.26
Go #3 1.40 19,808 610 1.44
Go #2 1.84 19,808 740 1.89
Go #8 2.46 19,808 727 2.47
Python 3 #4 4.54 19,312 348 4.54
Go #7 4.99 19,808 702 5.61
Python 3 #5   Failed  
regex-redux
source secs mem gz cpu secs
Python 3 #2 1.35 168,236 1411 2.64
Go #5 3.25 321,360 817 5.43
Python 3 8.91 432,220 515 16.44
Go #4 14.61 369,008 832 35.91
Go 25.37 319,956 749 61.07
Go #3 25.62 371,204 836 61.79
fasta
source secs mem gz cpu secs
Go 3.73 19,808 1055 3.74
Go #2 1.27 19,808 1405 4.06
Go #3 1.51 19,808 1362 4.09
Go #8 18.27 19,440 838 18.46
Python 3 #2 39.00 19,312 1126 39.00
Python 3 #3 39.12 19,312 1007 39.12
Python 3 #5 27.86 827,284 1951 53.94
Python 3 57.21 19,312 823 57.20
Python 3 #8 259.98 19,312 730 259.80
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
Python 3 #3 50.15 262,368 1970 185.77
Python 3 #8 236.77 623,232 522 235.97
Python 3 #4 79.01 506,112 663 236.67
Python 3 238.45 499,072 499 237.78
Python 3 #9 68.33 379,392 614 238.74
reverse-complement
source secs mem gz cpu secs
Go #2 2.19 800,640 614 2.29
Go #3 2.48 800,384 609 2.57
Go #6 1.91 1,244,508 1340 3.40
Python 3 #3 4.86 507,712 803 4.86
Python 3 #5 4.09 1,500,716 960 7.41
Python 3 #2 10.08 1,788,136 440 10.08
Python 3 10.29 1,986,440 484 10.29
Python 3 #6 7.38 2,484,372 821 10.89
Python 3 #4 13.41 4,002,688 343 13.41
Go #5   Bad Output  
Go   Failed  
binary-trees
source secs mem gz cpu secs
Go #6 27.90 404,096 618 29.26
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
Go 32.01 243,192 488 59.78
Go #7 32.52 248,604 531 61.47
Python 3 #2 100.90 271,872 344 100.89
Python 3 #4 33.61 276,992 481 121.96
Python 3 #5 35.49 274,816 669 126.17
Python 3 36.12 276,992 597 127.68
Python 3 #3 52.28 671,872 1247 149.07
Python 3 #8 558.92 798,336 535 558.85
Python 3

Python 3.13.0

Go

go version go1.23.1 linux/amd64
GOAMD64=v2