The Computer Language
22.05 Benchmarks Game

Fastest cpu secs C++ g++ 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++ g++ #6 2,000 1528 12.93
C gcc #4 964 1183 13.89
C++ g++ #7 992 1150 13.89
C gcc #5 1,072 910 29.38
C++ g++ #5 2,000 980 29.40
C++ g++ #4 2,216 1439 40.52
C++ g++ #3 988 593 40.55
C gcc #3 1,016 567 42.18
C++ g++ #2 2,224 1440 42.64
C++ g++ 2,164 1059 42.76
C gcc 988 508 43.27
C gcc #2 1,140 1557 45.01
n-body
source mem gz cpu
C gcc #9 992 1633 2.12
C++ g++ #0 964 1927 2.17
C++ g++ #2 1,944 1879 4.06
C gcc #8 8 1391 4.10
C++ g++ #7 1,976 1808 4.28
C gcc #4 1,304 1490 4.44
C++ g++ #9 1,260 1530 4.90
C++ g++ #6 1,300 1668 5.65
C++ g++ #4 1,040 1428 5.68
C++ g++ #3 1,280 1396 5.74
C++ g++ 1,260 1659 5.93
C++ g++ #8 1,220 1517 6.08
C gcc #5 1,020 1429 6.10
C++ g++ #5 1,944 1749 6.11
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
C gcc #5 1,344 569 2.85
C++ g++ #6 1,348 1044 2.85
C gcc #4 1,352 1139 2.85
C++ g++ #5 2,048 1044 5.26
C++ g++ 1,964 452 5.36
C gcc 1,248 383 5.38
C gcc #3 1,348 463 5.68
C++ g++ #8 1,348 1278 6.09
mandelbrot
source mem gz cpu
C++ g++ #4 34,720 3542 3.27
C++ g++ 32,336 1791 3.48
C++ g++ #6 31,792 1002 3.88
C++ g++ #0 34,712 2739 4.06
C gcc #6 31,244 1135 5.12
C gcc #8 33,068 782 6.29
C++ g++ #8 34,448 742 13.19
C++ g++ #5 33,640 590 13.37
C++ g++ #9 34,428 726 13.48
C gcc #4 32,704 799 13.81
C gcc #7 33,108 994 13.87
C gcc 29,692 822 13.91
C++ g++ #7 34,392 1017 13.92
C gcc #3 29,840 763 13.99
C gcc #9 32,904 694 16.03
C++ g++ #2 34,176 692 17.47
C gcc #2 1,040 400 25.30
C++ g++ #3 1,976 414 28.53
pidigits
source mem gz cpu
C++ g++ #4 4,220 513 0.71
C++ g++ #5 4,284 798 0.72
C gcc 2,648 452 0.73
C gcc #2 2,920 416 0.74
regex-redux
source mem gz cpu
C gcc #5 152,220 1397 2.02
C++ g++ #6 275,924 2850 2.20
C gcc #2 103,084 1115 3.23
C gcc #4 152,056 1230 3.24
C gcc #3 103,540 1266 3.31
C++ g++ #4 203,888 1315 3.39
C++ g++ 207,788 656 3.57
C++ g++ #2 198,316 700 3.69
C++ g++ #5 214,888 852 4.28
C++ g++ #3 217,248 853 18.28
fasta
source mem gz cpu
C gcc #9 1,256 1463 0.78
C gcc #5 1,052 1281 1.30
C++ g++ #8 2,720 2751 1.52
C++ g++ #2 2,004 1127 1.85
C++ g++ 2,000 1057 1.97
C++ g++ #3 1,964 1307 2.62
C gcc #8 1,044 1293 2.74
C gcc #6 2,140 1930 2.76
C gcc #4 1,020 1240 3.06
C gcc #2 2,860 2268 3.25
C gcc #7 2,864 2011 3.28
C++ g++ #4 1,016 1287 3.36
C gcc 1,016 1206 3.67
C++ g++ #5 4,540 2344 3.75
C++ g++ #6 4,564 2324 3.89
C gcc #3 972 819 4.49
C++ g++ #7   Make Error  
k-nucleotide
source mem gz cpu
C++ g++ #2 156,416 1631 5.92
C gcc 130,156 1506 12.31
C++ g++ #3 165,588 1276 14.14
C++ g++ 756,320 1446 14.54
reverse-complement
source mem gz cpu
C gcc #7 499,132 1965 0.57
C++ g++ #2 499,708 2093 0.64
C gcc #8 499,184 1627 0.77
C gcc #6 688,416 820 1.27
C gcc #5 994,088 647 1.42
C gcc #2 994,152 750 1.45
C++ g++ #3 500,008 840 2.62
C gcc #4 500,416 709 3.49
C++ g++ #6 1,513,136 1832 4.00
C++ g++ 979,988 592 6.34
C++ g++ #5 765,148 720 34.88
binary-trees
source mem gz cpu
C++ g++ #7 168,192 890 3.38
C++ g++ #5 200,020 885 4.10
C++ g++ #9 135,652 809 4.16
C gcc #2 168,384 809 4.32
C++ g++ #3 265,220 945 4.65
C gcc #3 134,068 836 4.71
C++ g++ #6 265,784 844 4.72
C++ g++ #8 265,808 820 5.05
C++ g++ 1,947,704 754 8.99
C gcc 263,664 654 22.16
C++ g++ #2 265,180 508 22.61
C gcc #5 351,304 908 32.02
C++ g++ #4   Make Error  
C++ g++

11.2.0-19ubuntu1

C gcc

11.2.0-19ubuntu1