The Computer Language
25.01 Benchmarks Game

Rust 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
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
* Rust #6 3.81 4,137 1260 15.16—15.32
Rust #4 6.90 4,141 1026 27.12
Rust #5 7.47 3,985 1023 29.34
Go #3 8.36 3,846 975 33.35
Rust #2 9.16 3,985 1198 35.93
Go #8 46.15 3,207 500 46.27—46.33
Go 12.27 4,903 906 49.09
Go #2 12.36 16,966 903 49.40
n-body
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
* Rust #9 2.19 3,195 1881 1.61—3.97
* Rust #7 3.24 2,937 1759 3.24
Rust #3 3.46 3,023 1774 3.46
Rust #2 3.65 3,019 1809 3.65
* Rust #6 4.36 3,019 1796 4.10—5.43
* Rust #5 5.02 3,027 2224 5.02
Rust #4 5.13 3,019 1810 4.83—6.12
Rust 5.52 3,019 1483 5.56—5.66
Go #3 6.39 3,191 1207 6.41
Go 7.02 3,228 1316 7.10—7.26
Go #2 7.04 3,203 1222 7.06
Go #8 9.60 3,191 1224 9.64
spectral-norm
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
* Rust #6 0.72 4,293 1132 2.85
Rust #4 0.72 4,014 823 2.85
* Rust #5 0.72 3,981 1062 2.85
* Rust 0.72 4,276 1262 2.86
* Rust #2 0.73 4,264 1117 2.86
* Rust #3 0.74 4,010 1060 2.94
Go #8 5.34 3,838 429 5.36
Go 5.34 4,059 417 5.36
Go #4 1.43 4,174 555 5.69
Go #2 1.51 4,317 674 5.70
* Rust #7   Empty  
mandelbrot
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
* Rust #4 0.95 35,955 1301 3.78
* Rust #6 1.08 36,385 1338 4.22
Rust #2 1.10 36,016 770 4.34
Rust #5 1.12 36,549 725 4.38
Rust #7 1.11 35,934 763 4.38
Rust #3 1.15 14,008 1013 4.57
Rust 2.03 42,541 874 7.90
Go #4 3.77 37,970 912 15.02
Go #3 3.78 38,101 900 15.03
Go 5.04 35,787 829 20.05
Go #8 26.70 3,199 500 26.77
Go #2 6.87 35,549 843 27.32
Go #6 6.91 35,119 707 27.48
fasta
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
* Rust #7 0.78 4,866 2533 1.55
Rust #3 1.98 2,933 1235 1.98
Rust #9 0.94 5,362 1952 3.22—3.29
Rust #5 0.94 5,505 1963 3.34—3.43
Rust #2 0.94 5,550 1910 3.45—3.49
Rust #6 3.48 128,033 959 3.48
Rust #4 3.48 128,160 944 3.48
Go 3.74 3,207 1055 3.76
Go #2 1.27 12,644 1405 4.08
Go #3 1.52 5,095 1362 4.10
Rust 4.49 2,990 1240 4.51—4.55
Go #8 11.22 9,052 880 11.56—11.78
k-nucleotide
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
Rust #7 2.61 139,071 1585 8.25—8.47
Rust #3 3.24 141,701 1549 9.49—9.79
Rust #6 2.81 165,057 1697 10.18—10.41
Rust #5 3.82 143,118 1745 11.26—11.52
Rust #2 6.05 143,139 1350 15.56—16.02
Rust #9 6.58 140,845 1850 17.43—18.35
Rust #4 6.76 142,778 1755 18.85—19.78
Go #7 7.58 168,186 1613 28.84—29.07
Go #3 8.20 150,413 1729 30.03—30.65
Go #6 8.30 150,442 1596 30.25—30.72
Go #4 9.27 144,650 1552 32.19—35.02
Go #8 61.38 558,379 752 62.40—62.80
Rust 21.38 159,539 1086 65.42—66.28
reverse-complement
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
* Rust 0.54 513,090 2762 0.85
Rust #2 0.99 1,022,960 1332 1.63
Rust #3 1.00 1,022,190 1105 1.73
Go #2 2.22 822,211 614 2.35—2.38
Go #3 2.50 821,985 609 2.62—2.66
Go #6 1.93 1,277,608 1340 3.47—3.52
Go #5   Bad Output  
Go   Empty  
binary-trees
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
Rust #5 1.10 137,413 771 3.96—4.09
Rust #2 1.21 141,509 729 4.32—4.37
Rust #4 1.38 171,651 765 5.04—5.11
Rust #3 1.40 162,599 762 5.05—5.11
Rust 2.07 137,667 760 7.21—7.27
Go #6 27.93 416,195 618 29.34—29.64
Go #2 14.21 635,613 672 56.45—56.54
Go #3 14.90 329,499 806 57.99—58.16
Go #5 14.68 386,056 957 57.78—58.05
Go 32.05 243,114 488 59.82—59.99
Go #7 32.57 241,345 531 61.41—61.52
pidigits
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
Rust #4 0.72 3,994 804 0.72
* Rust 0.75 4,239 1426 0.75
* Rust #2 0.75 4,243 1312 0.75
* Rust #3 0.75 4,481 1373 0.75
* Go #4 0.82 6,402 689 0.84
Go 1.15 7,533 715 1.23—1.30
* Go #3 1.17 6,885 610 1.36—1.48
Go #2 1.76 7,823 740 1.90—2.02
Go #6 2.47 10,703 727 2.48
Go #7 5.00 10,527 702 5.65
regex-redux
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
Rust #6 1.18 160,154 994 1.43
Rust #5 1.34 210,186 777 1.58
Rust 1.33 160,023 811 1.57—1.60
Rust #4 1.35 206,840 771 1.60
Rust #3 1.36 210,850 726 1.59—1.64
Rust #2 1.39 160,625 707 1.64
* Rust #7 0.79 155,496 2464 2.01
Go #5 3.23 297,800 817 5.40—5.44
Go #4 14.49 349,008 832 35.23—35.68
Go #3 25.15 336,585 836 61.82—63.36
Go 25.79 301,662 749 61.97—62.93
Rust

1.83.0
(90b35a623
2024-11-26)
LLVM version: 19.1.1

Go

go version go1.23.1 linux/amd64
GOAMD64=v2