The Computer Language
24.06 Benchmarks Game

Rust versus C gcc 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
C gcc #6 2.17 19,684 1582 8.56
C gcc #4 14.21 19,684 1190 14.21
Rust #6 3.82 19,684 1260 15.13
C gcc #5 6.98 19,684 917 27.28
Rust #4 7.58 19,684 1026 29.78
Rust #5 8.00 19,684 1023 31.31
Rust #2 9.23 19,684 1198 36.15
C gcc #3 39.56 19,684 574 39.56
C gcc 42.31 19,684 514 42.31
C gcc #2 10.85 19,684 1563 42.52
n-body
source secs mem gz cpu secs
C gcc #9 2.10 19,704 1639 2.10
Rust #9 2.16 19,716 1881 2.16
Rust #7 3.24 19,700 1759 3.24
C gcc #8 3.70 19,684 1398 3.69
Rust #2 3.94 19,700 1809 3.94
C gcc #4 4.31 19,684 1496 4.31
Rust #6 4.32 19,716 1796 4.32
Rust #8 4.49 19,684 1774 4.49
C gcc #6 4.97 19,684 1186 4.97
Rust #5 5.02 19,716 2224 5.02
Rust #4 5.18 19,716 1810 5.18
C gcc 5.18 19,684 1179 5.18
C gcc #2 5.20 19,684 1270 5.20
C gcc #3 5.24 19,684 1214 5.24
C gcc #5 5.43 19,684 1436 5.43
Rust 5.51 19,716 1483 5.51
Rust #3 5.56 19,716 1546 5.56
C gcc #7 6.82 19,684 1250 6.82
spectral-norm
source secs mem gz cpu secs
C gcc #6 0.39 19,724 1203 1.54
Rust #6 0.72 19,780 1132 2.85
Rust #5 0.72 19,748 1062 2.85
Rust #7 0.72 19,748 938 2.85
C gcc #4 0.72 19,724 1145 2.85
Rust #4 0.72 19,812 823 2.85
C gcc #7 0.72 19,724 906 2.85
C gcc #5 0.72 19,708 576 2.86
Rust 0.79 19,748 1262 3.02
Rust #2 0.78 19,748 1117 3.04
Rust #3 0.92 19,748 1060 3.56
C gcc 5.39 19,724 390 5.39
C gcc #3 1.43 19,708 470 5.70
C gcc #8   Make Error  
mandelbrot
source secs mem gz cpu secs
Rust #4 0.94 33,280 1301 3.73
Rust #6 1.07 34,048 1338 4.21
Rust #8 1.06 33,152 770 4.22
Rust #7 1.06 33,280 763 4.23
Rust #5 1.14 33,920 725 4.46
Rust #3 1.14 19,684 1013 4.54
C gcc #6 1.29 33,408 1147 5.13
C gcc #8 1.63 33,536 788 6.31
Rust 2.04 39,168 874 7.88
C gcc #4 3.49 33,152 805 13.88
C gcc #7 3.50 33,280 1000 13.91
C gcc 3.50 32,768 828 13.93
C gcc #3 3.53 32,768 769 14.09
C gcc #9 4.23 33,280 700 16.34
C gcc #2 25.05 19,684 412 25.04
pidigits
source secs mem gz cpu secs
Rust #4 0.71 19,720 804 0.71
C gcc #2 0.82 19,704 422 0.82
Rust #3 0.88 19,720 1373 0.88
Rust #2 0.89 19,720 1312 0.88
C gcc 0.89 19,704 459 0.88
Rust 0.89 19,720 1426 0.89
regex-redux
source secs mem gz cpu secs
Rust #6 1.19 153,464 994 1.44
Rust #5 1.30 202,600 777 1.54
Rust 1.31 153,796 811 1.57
Rust #4 1.34 199,556 771 1.59
Rust #3 1.33 202,916 726 1.59
Rust #2 1.37 153,780 707 1.61
Rust #7 0.78 150,528 2464 2.00
C gcc #5 0.81 152,392 1403 2.03
C gcc #2 3.21 103,296 1121 3.21
C gcc #4 0.95 152,248 1237 3.27
C gcc #3 1.73 103,680 1273 3.31
fasta
source secs mem gz cpu secs
C gcc #9 0.78 19,684 1469 0.78
C gcc #5 1.24 19,684 1286 1.24
Rust #7 0.77 19,684 2533 1.54
Rust #3 1.99 19,684 1235 1.99
C gcc #6 0.94 19,684 1936 2.77
C gcc #8 2.79 19,684 1299 2.79
C gcc #4 3.03 19,684 1244 3.03
C gcc #2 0.82 19,684 2276 3.25
Rust #8 0.94 19,684 1952 3.26
C gcc #7 0.84 19,684 2018 3.27
Rust #2 0.92 19,684 1910 3.33
Rust #5 0.92 19,684 1963 3.40
Rust #4 3.45 123,656 944 3.45
Rust #6 3.50 123,656 959 3.50
C gcc 3.74 19,684 1213 3.74
Rust 4.17 19,684 1240 4.17
C gcc #3 4.56 19,684 825 4.56
k-nucleotide
source secs mem gz cpu secs
Rust #7 2.85 133,876 1585 8.96
Rust #8 3.77 137,492 1549 10.88
Rust #6 3.01 159,340 1697 10.96
Rust #5 4.17 137,816 1745 12.38
C gcc 3.98 130,432 1512 12.93
Rust #2 6.30 138,236 1350 16.32
Rust #9 6.39 135,948 1850 17.33
Rust #4 6.57 137,384 1755 17.75
Rust 22.83 157,276 1086 69.30
reverse-complement
source secs mem gz cpu secs
C gcc #7 0.43 499,928 1899 0.59
C gcc #8 0.49 499,868 1551 0.81
Rust 0.52 498,688 2762 0.82
C gcc #6 0.97 696,664 828 1.39
C gcc #5 1.52 994,176 654 1.52
C gcc #2 1.05 994,560 757 1.57
Rust #2 0.95 995,200 1332 1.59
Rust #3 0.96 995,200 1105 1.65
C gcc #4 3.68 500,480 716 3.68
binary-trees
source secs mem gz cpu secs
Rust #5 1.10 198,528 771 3.84
Rust #2 1.24 199,684 729 4.40
C gcc #2 1.57 169,216 816 4.48
C gcc #3 1.92 134,400 842 4.70
Rust #4 1.31 181,692 765 4.74
Rust #3 1.43 194,868 762 5.18
Rust 2.04 132,736 760 7.18
C gcc 21.32 264,064 660 21.32
C gcc #5 8.66 351,232 914 31.56
Rust

1.78.0
(9b00956e5
2024-04-29)
LLVM version: 18.1.2

C gcc

13.2.0-23ubuntu4