The Computer Language
23.02 Benchmarks Game

Go versus Rust 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
Rust #6 3.51 11,036 1253 13.93
Rust #4 7.21 10,932 1020 28.34
Rust #5 7.77 10,932 1016 30.49
Go #3 8.25 10,936 969 32.92
Go 11.83 11,128 900 47.26
Go #2 11.89 12,708 896 47.47
Rust #2 17.99 11,036 1191 70.95
n-body
source secs mem gz cpu secs
Rust #9 2.81 11,068 1874 2.81
Rust #7 3.27 11,068 1753 3.27
Rust #6 3.92 11,068 1790 3.92
Rust #3 5.63 11,068 1540 5.63
Rust 5.63 11,068 1480 5.63
Rust #2 5.98 11,068 1805 5.98
Rust #8 6.01 11,068 1767 6.01
Rust #5 6.12 11,068 2220 6.11
Rust #4 6.20 11,068 1803 6.20
Go #3 6.36 11,244 1200 6.37
Go 6.55 11,244 1310 6.56
Go #2 6.94 11,244 1215 6.95
spectral-norm
source secs mem gz cpu secs
Rust #6 0.71 11,124 1126 2.84
Rust #7 0.72 11,128 932 2.84
Rust #5 0.72 11,124 1055 2.84
Rust #4 0.72 11,124 817 2.84
Rust #2 0.72 11,124 1110 2.85
Rust 0.72 11,124 1254 2.85
Rust #3 0.78 11,124 1053 3.07
Go 5.31 11,244 411 5.32
Go #4 1.42 11,244 548 5.67
Go #2 1.44 11,244 668 5.67
mandelbrot
source secs mem gz cpu secs
Rust #4 1.01 32,380 1295 3.99
Rust #6 1.06 34,120 1332 4.18
Rust #5 1.12 33,868 719 4.41
Rust #3 1.15 13,452 1007 4.58
Rust #7 1.42 32,124 757 5.64
Rust #8 1.42 32,176 763 5.64
Rust 2.05 38,724 868 8.09
Go #3 3.73 36,140 894 14.86
Go #4 3.73 36,116 905 14.87
Go 4.92 33,624 823 19.65
Go #2 6.76 33,928 837 26.97
Go #6 6.83 33,632 700 27.22
pidigits
source secs mem gz cpu secs
Rust #4 0.71 11,068 799 0.71
Rust #2 0.88 11,068 1306 0.88
Rust #3 0.88 11,068 1366 0.88
Rust 0.89 11,068 1420 0.88
Go #4 1.01 11,244 683 1.02
Go 1.37 11,244 708 1.38
Go #3 1.63 11,244 603 1.66
Go #2 1.97 11,244 733 2.00
Go #8 2.46 11,244 720 2.46
Go #7 4.80 23,844 696 5.31
regex-redux
source secs mem gz cpu secs
Rust #6 1.34 152,724 986 1.80
Rust #5 1.40 204,604 771 1.82
Rust #4 1.43 204,656 765 1.85
Rust 1.46 153,312 804 1.87
Rust #3 1.42 205,228 719 1.88
Rust #2 1.50 153,320 701 1.90
Rust #7 0.78 149,524 2458 1.99
Go #5 4.14 302,280 810 6.25
Go #4 14.80 360,260 829 34.62
Go #3 27.89 368,528 829 67.15
Go 28.35 317,752 741 67.40
fasta
source secs mem gz cpu secs
Rust #7 0.76 11,068 2529 1.52
Rust #3 2.00 11,036 1233 2.00
Rust #5 0.90 11,060 1961 3.08
Rust #2 0.90 11,068 1906 3.16
Rust #4 3.46 123,660 939 3.46
Rust #6 3.50 123,660 955 3.50
Rust #8 0.92 11,068 1946 3.50
Go 3.78 11,128 1053 3.78
Go #3 1.49 11,136 1358 4.10
Go #2 1.26 11,136 1404 4.26
Rust 4.52 11,036 1237 4.52
k-nucleotide
source secs mem gz cpu secs
Rust #7 2.88 133,236 1578 9.14
Rust #8 3.56 137,632 1543 10.34
Rust #6 2.88 158,788 1691 10.48
Rust #5 4.08 137,648 1739 11.99
Rust #2 6.30 137,548 1347 16.69
Rust #9 6.54 136,008 1841 17.81
Rust #4 6.95 136,744 1749 18.88
Go #7 7.48 166,412 1607 28.68
Go #6 7.96 148,080 1590 29.25
Go #3 8.28 148,412 1722 29.93
Go #4 9.50 142,624 1543 31.55
Rust 21.93 155,840 1078 65.94
reverse-complement
source secs mem gz cpu secs
Rust 0.47 498,844 3040 0.77
Rust #2 0.80 995,004 1330 1.45
Rust #3 0.81 995,004 1097 1.50
Go #2 1.76 814,544 611 1.80
Go #3 1.96 814,352 605 2.00
Go #6 1.33 1,278,596 1338 2.46
Go #5   Bad Output  
Go   Failed  
binary-trees
source secs mem gz cpu secs
Rust #5 1.08 198,984 765 3.82
Rust #2 1.19 200,532 721 4.27
Rust #4 1.28 198,772 756 4.62
Rust #3 1.36 198,464 754 4.93
Rust 2.10 132,828 751 7.39
Go #6 27.82 410,808 611 28.59
Go #5 14.70 406,544 950 57.87
Go #2 14.69 642,688 666 58.49
Go #3 15.07 342,008 799 58.61
Go #7 33.37 247,824 525 60.85
Go 34.62 236,728 482 61.41
Go

go version go1.20 linux/amd64
GOAMD64=v2

Rust

1.67.0
(fc594f156
2023-01-24)
LLVM version: 15.0.6