The Computer Language
24.11 Benchmarks Game

Go versus Rust 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
* Rust #6 3.88 19,804 1260 15.27
Rust #4 6.93 19,804 1026 27.20
Rust #5 7.66 19,804 1023 29.90
Go #3 8.34 19,808 975 33.31
Rust #2 9.15 19,804 1198 35.90
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
* Rust #9 2.19 19,804 1881 2.19
* Rust #7 3.25 19,804 1759 3.24
Rust #2 3.94 19,804 1809 3.94
* Rust #6 4.30 19,804 1796 4.30
Rust #3 4.49 19,352 1774 4.49
* Rust #5 5.01 19,804 2224 5.01
Rust #4 5.10 19,804 1810 5.10
Rust 5.51 19,804 1483 5.51
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
spectral-norm
source secs mem gz cpu secs
* Rust #6 0.72 19,804 1132 2.85
Rust #4 0.72 19,804 823 2.85
* Rust #5 0.72 19,804 1062 2.85
* Rust #2 0.78 19,804 1117 2.98
* Rust 0.77 19,804 1262 2.99
* Rust #3 0.78 19,804 1060 3.00
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
* Rust #7   Make Error  
mandelbrot
source secs mem gz cpu secs
* Rust #4 0.94 33,408 1301 3.73
Rust #2 1.07 33,592 770 4.23
* Rust #6 1.08 34,048 1338 4.23
Rust #7 1.06 33,408 763 4.23
Rust #5 1.13 34,048 725 4.43
Rust #3 1.14 19,860 1013 4.54
Rust 2.00 39,296 874 7.84
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
fasta
source secs mem gz cpu secs
* Rust #7 0.77 19,804 2533 1.54
Rust #3 1.98 19,804 1235 1.97
Rust #2 0.92 19,932 1910 3.09
Rust #9 0.93 19,352 1952 3.13
Rust #5 0.94 19,932 1963 3.14
Rust #6 3.46 123,652 959 3.45
Rust #4 3.57 123,652 944 3.57
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
Rust 4.24 19,804 1240 4.24
Go #8 18.27 19,440 838 18.46
k-nucleotide
source secs mem gz cpu secs
Rust #7 2.84 133,840 1585 8.91
Rust #6 2.96 159,600 1697 10.67
Rust #3 3.52 137,568 1549 10.78
Rust #5 3.96 137,844 1745 11.95
Rust #2 6.28 138,736 1350 16.39
Rust #9 6.44 135,800 1850 17.00
Rust #4 6.74 137,440 1755 18.30
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
Rust 22.54 157,124 1086 67.38
reverse-complement
source secs mem gz cpu secs
* Rust 0.53 498,816 2762 0.83
Rust #2 0.98 995,200 1332 1.62
Rust #3 0.98 995,200 1105 1.68
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
Go #5   Bad Output  
Go   Failed  
binary-trees
source secs mem gz cpu secs
Rust #5 1.08 198,656 771 3.77
Rust #2 1.22 199,684 729 4.29
Rust #4 1.33 187,948 765 4.80
Rust #3 1.40 188,740 762 5.06
Rust 2.05 132,992 760 7.21
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
pidigits
source secs mem gz cpu secs
Rust #4 0.71 19,804 804 0.71
* Rust #3 0.74 19,804 1373 0.74
* Rust 0.74 19,804 1426 0.74
* Rust #2 0.74 19,804 1312 0.74
* 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
Rust #6 1.18 154,096 994 1.44
Rust 1.33 153,792 811 1.58
Rust #5 1.34 203,224 777 1.58
Rust #2 1.34 153,776 707 1.60
Rust #4 1.35 199,548 771 1.61
Rust #3 1.36 202,908 726 1.61
* Rust #7 0.78 149,888 2464 1.99
Go #5 3.25 321,360 817 5.43
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
Go

go version go1.23.1 linux/amd64
GOAMD64=v2

Rust

1.80.1
(3f5fd8dd4
2024-08-06)
LLVM version: 18.1.7