The Computer Language
24.06 Benchmarks Game

C gcc versus C clang 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 clang #6 2.25 19,940 1582 8.89
C clang #4 13.18 19,684 1190 13.18
C gcc #4 14.21 19,684 1190 14.21
C gcc #5 6.98 19,684 917 27.28
C clang #5 8.08 19,940 917 31.87
C clang #3 34.04 19,684 574 34.04
C clang #2 8.88 19,684 1563 34.87
C clang 37.45 19,684 514 37.45
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
C clang #9 2.20 19,684 1639 2.20
C gcc #8 3.70 19,684 1398 3.69
C gcc #4 4.31 19,684 1496 4.31
C clang #4 4.63 19,684 1496 4.63
C clang #5 4.86 19,684 1436 4.86
C gcc #6 4.97 19,684 1186 4.97
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 clang #6 5.32 19,684 1186 5.32
C gcc #5 5.43 19,684 1436 5.43
C clang #2 5.50 19,684 1270 5.50
C clang 5.51 19,716 1179 5.51
C clang #8 5.59 19,748 1398 5.59
C clang #3 6.12 19,684 1214 6.11
C clang #7 6.77 19,684 1250 6.77
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
C clang #6 0.40 20,980 1203 1.57
C gcc #4 0.72 19,724 1145 2.85
C gcc #7 0.72 19,724 906 2.85
C gcc #5 0.72 19,708 576 2.86
C clang #5 0.72 19,700 576 2.87
C clang #8 0.73 19,700 941 2.88
C clang #4 0.73 20,820 1145 2.89
C gcc 5.39 19,724 390 5.39
C clang 5.40 19,700 390 5.40
C gcc #3 1.43 19,708 470 5.70
C clang #3 1.44 20,916 470 5.75
C clang #7 1.84 20,756 906 7.28
C gcc #8   Make Error  
mandelbrot
source secs mem gz cpu secs
C clang #9 1.23 34,304 700 4.89
C gcc #6 1.29 33,408 1147 5.13
C clang #8 1.53 34,688 788 6.09
C gcc #8 1.63 33,536 788 6.31
C clang #4 3.47 34,176 805 13.83
C gcc #4 3.49 33,152 805 13.88
C gcc #7 3.50 33,280 1000 13.91
C clang 3.49 33,024 828 13.92
C gcc 3.50 32,768 828 13.93
C clang #7 3.53 34,048 1000 14.02
C gcc #3 3.53 32,768 769 14.09
C clang #3 3.58 32,896 769 14.26
C gcc #9 4.23 33,280 700 16.34
C gcc #2 25.05 19,684 412 25.04
C clang #2 25.50 19,684 412 25.49
C clang #6   Make Error  
pidigits
source secs mem gz cpu secs
C clang #2 0.82 19,780 422 0.82
C gcc #2 0.82 19,704 422 0.82
C gcc 0.89 19,704 459 0.88
C clang 0.88 19,876 459 0.88
regex-redux
source secs mem gz cpu secs
C gcc #5 0.81 152,392 1403 2.03
C clang #5 0.82 154,520 1403 2.82
C gcc #2 3.21 103,296 1121 3.21
C clang #2 3.22 103,424 1121 3.22
C gcc #4 0.95 152,248 1237 3.27
C gcc #3 1.73 103,680 1273 3.31
C clang #4 0.97 154,248 1237 3.77
C clang #3 1.74 105,728 1273 4.32
fasta
source secs mem gz cpu secs
C clang #9 0.78 19,684 1469 0.78
C gcc #9 0.78 19,684 1469 0.78
C clang #5 1.19 19,684 1286 1.19
C gcc #5 1.24 19,684 1286 1.24
C clang #8 2.43 19,684 1299 2.43
C gcc #6 0.94 19,684 1936 2.77
C gcc #8 2.79 19,684 1299 2.79
C clang #6 1.01 19,684 1936 2.96
C gcc #4 3.03 19,684 1244 3.03
C gcc #2 0.82 19,684 2276 3.25
C clang #2 0.82 19,684 2276 3.26
C gcc #7 0.84 19,684 2018 3.27
C clang #7 0.85 19,684 2018 3.31
C clang 3.61 19,860 1213 3.61
C gcc 3.74 19,684 1213 3.74
C gcc #3 4.56 19,684 825 4.56
C clang #3 4.58 19,860 825 4.58
C clang #4   Make Error  
k-nucleotide
source secs mem gz cpu secs
C gcc 3.98 130,432 1512 12.93
C clang 6.37 129,248 1512 13.99
reverse-complement
source secs mem gz cpu secs
C gcc #7 0.43 499,928 1899 0.59
C clang #7 0.44 499,748 1899 0.61
C clang #8 0.46 499,876 1551 0.70
C gcc #8 0.49 499,868 1551 0.81
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
C clang #2 1.15 994,560 757 1.67
C clang #5 2.07 994,176 654 2.07
C gcc #4 3.68 500,480 716 3.68
C clang #4 3.79 500,480 716 3.79
C clang #6 1.02 706,096 828 4.04
binary-trees
source secs mem gz cpu secs
C gcc #2 1.57 169,216 816 4.48
C gcc #3 1.92 134,400 842 4.70
C clang #2 1.64 170,112 816 5.30
C clang #3 1.84 134,144 842 5.79
C clang 17.79 264,064 660 17.79
C gcc 21.32 264,064 660 21.32
C gcc #5 8.66 351,232 914 31.56
C clang #5 9.39 351,232 914 33.96
C gcc

13.2.0-23ubuntu4

C clang

Ubuntu clang version 18.1.3