The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Rust versus C gcc

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 cpu seconds, less gz source code.

fannkuch-redux
source mem gz cpu
C gcc #6 1,044 1576 8.26
C gcc #4 964 1183 13.89
Rust #6 1,372 1253 14.15
C gcc #5 1,072 910 29.38
Rust #4 1,372 1020 30.06
Rust #3 1,336 1020 30.07
Rust #5 1,368 1016 30.11
C gcc #3 1,016 567 42.18
C gcc 988 508 43.27
C gcc #2 1,140 1557 45.01
Rust #2 1,232 1191 72.42
n-body
source mem gz cpu
C gcc #9 992 1633 2.12
Rust #9 1,052 1874 2.89
Rust #7 1,052 1753 3.24
Rust #6 1,028 1790 4.05
C gcc #8 8 1391 4.10
C gcc #4 1,304 1490 4.44
Rust #3 1,108 1540 5.49
Rust #2 1,032 1805 5.67
Rust 1,044 1480 5.68
Rust #8 1,104 1767 5.78
C gcc #5 1,020 1429 6.10
Rust #5 1,104 2220 6.10
Rust #4 1,088 1803 6.25
C gcc #7 1,300 1244 6.79
C gcc #2 1,264 1263 7.19
C gcc #6 1,304 1180 7.21
C gcc #3 1,304 1208 7.23
C gcc 1,264 1173 7.55
spectral-norm
source mem gz cpu
C gcc #6 1,068 1197 1.57
Rust #5 2,560 1055 2.84
Rust #6 2,432 1126 2.84
Rust #7 2,436 932 2.84
Rust #4 2,640 817 2.84
C gcc #5 1,344 569 2.85
C gcc #4 1,352 1139 2.85
Rust #2 1,312 1110 2.87
Rust 1,276 1254 2.87
Rust #3 1,248 1053 2.98
C gcc 1,248 383 5.38
C gcc #3 1,348 463 5.68
mandelbrot
source mem gz cpu
Rust #6 33,872 1332 4.18
C gcc #6 31,244 1135 5.12
Rust #8 32,624 763 5.48
Rust #7 32,732 757 5.50
Rust #3 12,824 1007 5.52
C gcc #8 33,068 782 6.29
Rust 38,672 868 6.87
Rust #5 33,948 719 10.40
C gcc #4 32,704 799 13.81
C gcc #7 33,108 994 13.87
C gcc 29,692 822 13.91
C gcc #3 29,840 763 13.99
C gcc #9 32,904 694 16.03
C gcc #2 1,040 400 25.30
pidigits
source mem gz cpu
Rust #4 2,624 799 0.71
C gcc 2,648 452 0.73
C gcc #2 2,920 416 0.74
Rust #2 2,924 1306 0.74
Rust 2,928 1420 0.74
Rust #3 2,960 1366 0.83
regex-redux
source mem gz cpu
Rust #6 153,148 986 1.79
Rust #5 202,556 771 1.83
Rust 152,864 804 1.83
Rust #4 202,612 765 1.87
Rust #3 203,408 719 1.89
Rust #2 152,172 701 1.89
Rust #7 147,360 2458 1.99
C gcc #5 152,220 1397 2.02
C gcc #2 103,084 1115 3.23
C gcc #4 152,056 1230 3.24
C gcc #3 103,540 1266 3.31
fasta
source mem gz cpu
C gcc #9 1,256 1463 0.78
C gcc #5 1,052 1281 1.30
Rust #7 2,052 2529 1.52
Rust #3 1,104 1233 2.03
C gcc #8 1,044 1293 2.74
C gcc #6 2,140 1930 2.76
C gcc #4 1,020 1240 3.06
Rust #5 2,580 1961 3.10
Rust #2 2,580 1906 3.18
C gcc #2 2,860 2268 3.25
C gcc #7 2,864 2011 3.28
Rust #8 2,596 1946 3.55
Rust #4 123,860 939 3.57
Rust #6 123,848 955 3.58
C gcc 1,016 1206 3.67
Rust 1,100 1237 4.45
C gcc #3 972 819 4.49
k-nucleotide
source mem gz cpu
Rust #7 131,236 1578 9.12
Rust #8 137,632 1543 10.39
Rust #6 159,088 1691 10.68
Rust #5 133,912 1739 12.23
C gcc 130,156 1506 12.31
Rust #2 137,896 1347 16.27
Rust #9 134,732 1841 18.77
Rust #4 136,216 1749 19.31
Rust 152,220 1078 70.04
reverse-complement
source mem gz cpu
C gcc #7 499,132 1965 0.57
Rust 499,068 3040 0.76
C gcc #8 499,184 1627 0.77
C gcc #6 688,416 820 1.27
Rust #2 995,032 1330 1.36
C gcc #5 994,088 647 1.42
C gcc #2 994,152 750 1.45
Rust #3 995,032 1097 1.52
C gcc #4 500,416 709 3.49
binary-trees
source mem gz cpu
Rust #5 198,536 765 3.60
Rust #2 200,024 721 4.17
C gcc #2 168,384 809 4.32
Rust #4 181,444 756 4.40
C gcc #3 134,068 836 4.71
Rust #3 163,904 754 4.87
Rust 132,604 751 7.70
C gcc 263,664 654 22.16
C gcc #5 351,304 908 32.02
Rust

rustc 1.60.0
(7737e0b5c
2022-04-04)
LLVM version: 14.0.0

C gcc

11.2.0-19ubuntu1