The Computer Language
24.11 Benchmarks Game

C++ g++ versus C# aot 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# aot #5 2.16 19,620 1485 8.57
* C++ g++ #6 3.31 19,760 1535 13.11
* C++ g++ #7 14.03 19,760 1156 14.03
C++ g++ #5 7.85 19,760 987 30.68
C# aot #2 31.28 19,620 584 31.27
C# aot #9 8.10 19,620 1232 32.31
C++ g++ #4 8.92 19,760 1445 35.00
C++ g++ #2 9.13 19,760 1446 35.73
C++ g++ #3 37.88 19,760 600 37.87
C# aot #6 10.11 19,620 1075 40.42
C++ g++ 10.49 19,760 1065 41.21
C# aot #3 11.00 19,620 1117 43.50
C# aot #8 44.61 19,620 519 44.60
n-body
source secs mem gz cpu secs
* C++ g++ #0 2.15 19,760 1933 2.15
C# aot #9 3.11 19,620 2480 3.11
C# aot #4 3.69 19,620 2137 3.69
* C++ g++ #7 4.11 19,760 1815 4.11
C# aot #7 4.73 19,620 1715 4.73
C# aot #6 4.75 19,620 1754 4.75
C++ g++ #9 5.14 19,760 1536 5.14
C++ g++ #3 5.32 19,760 1402 5.32
* C++ g++ #4 5.45 19,760 1434 5.45
* C++ g++ #2 6.02 19,352 1524 6.01
C++ g++ #5 6.32 19,760 1544 6.32
C# aot #0 6.39 19,620 1342 6.39
C# aot 6.39 19,620 1424 6.39
C++ g++ 6.61 19,760 1666 6.61
C# aot #3 6.65 19,620 1311 6.65
C# aot #2 6.80 19,620 1339 6.80
C++ g++ #6 6.93 19,760 1674 6.93
C# aot #8 7.00 19,620 1335 7.00
spectral-norm
source secs mem gz cpu secs
* C++ g++ #6 0.73 19,760 1050 2.86
C# aot #5 0.73 19,620 776 2.87
* C++ g++ #5 1.33 19,760 1050 5.28
C# aot #8 5.33 19,620 441 5.33
C++ g++ 5.33 19,760 459 5.33
C# aot #2 1.47 19,620 1084 5.71
C# aot #3 1.47 19,620 890 5.79
C++ g++ #7 1.52 19,512 1284 6.04
mandelbrot
source secs mem gz cpu secs
* C++ g++ #4 0.89 35,344 3554 3.45
* C++ g++ 0.89 34,952 1797 3.47
* C++ g++ #6 0.98 35,080 1014 3.87
C++ g++ #0 2.35 35,476 2752 9.30
C# aot #7 2.95 36,040 915 11.72
* C++ g++ #7 4.86 35,176 749 13.28
C++ g++ #5 13.44 34,636 596 13.43
C++ g++ #9 3.52 35,120 732 13.55
C# aot 3.75 36,080 1980 14.93
C# aot #9 3.76 36,024 822 14.94
C# aot #5 4.00 37,728 851 15.87
C++ g++ #2 16.95 34,636 700 16.94
C# aot #8 25.56 19,620 492 25.55
C# aot #3 6.67 36,584 722 26.51
C++ g++ #3 27.37 19,760 421 27.36
C# aot #2 46.14 19,620 504 46.12
fasta
source secs mem gz cpu secs
C# aot #9 1.15 19,620 1512 1.15
C++ g++ #9 0.78 19,352 2758 1.54
C++ g++ #2 1.84 19,760 1129 1.84
C++ g++ 1.92 19,760 1064 1.92
C++ g++ #3 2.63 19,760 1311 2.63
C++ g++ #7 0.87 19,760 2711 3.05
C++ g++ #4 3.32 19,760 1291 3.32
C++ g++ #5 1.06 19,760 2345 3.66
C++ g++ #6 1.07 19,760 2326 4.01
C# aot #5 1.08 45,836 1702 4.23
C# aot 1.60 19,620 2113 5.69
C# aot #8 11.92 19,620 883 11.91
k-nucleotide
source secs mem gz cpu secs
C++ g++ #2 2.01 156,592 1634 5.98
C# aot 3.08 153,728 2046 10.56
C# aot #6 5.08 152,196 1615 12.83
C++ g++ #3 4.19 165,580 1280 13.94
C++ g++ 6.96 757,156 1452 14.75
C# aot #4 12.88 577,808 1725 45.69
C# aot #7 47.60 571,928 1449 48.16
C# aot #8 72.83 1,322,384 736 73.39
reverse-complement
source secs mem gz cpu secs
* C++ g++ #2 0.74 499,916 2099 0.74
C# aot 3.23 548,304 1130 3.25
C# aot #5 2.71 998,644 1620 3.73
C# aot #7 1.43 816,640 1312 3.92
C# aot #6 1.71 1,001,884 1627 4.12
C++ g++ #6 3.30 1,517,824 1827 4.38
C++ g++ 6.52 980,156 599 6.51
C# aot #3 8.66 1,368,572 934 13.17
C++ g++ #5 37.59 771,632 704 37.58
C# aot #9   Bad Output  
C++ g++ #3   Bad Output  
binary-trees
source secs mem gz cpu secs
C++ g++ #7 0.97 201,512 896 3.40
C++ g++ #5 1.16 200,724 891 4.10
C++ g++ #9 1.74 136,120 815 4.63
C++ g++ #3 1.91 265,636 951 4.74
C++ g++ #6 1.91 266,120 851 4.77
C++ g++ #4 2.22 266,136 826 5.20
C++ g++ 2.65 2,153,044 760 9.23
C# aot #8 14.53 835,476 601 16.02
C# aot #2 5.04 1,203,112 717 16.32
C# aot #7 5.32 1,167,436 706 17.19
C# aot #3 5.85 2,944,336 688 17.86
C# aot 5.69 2,875,588 668 18.10
C++ g++ #2 22.83 265,840 514 22.82
C# aot #6   Make Error  
pidigits
source secs mem gz cpu secs
C++ g++ #4 0.71 19,760 521 0.71
* C++ g++ #5 0.73 19,760 804 0.73
C# aot #6 0.74 19,620 1182 0.74
C# aot #4 4.53 19,620 1135 4.53
C# aot #7 6.43 19,620 579 6.39
C# aot #5 99.21 19,620 990 99.18
regex-redux
source secs mem gz cpu secs
C++ g++ #6 1.15 276,336 2856 2.24
C# aot #2 1.30 327,112 1881 2.50
C# aot 10.61 566,272 641 10.61
C# aot #5 3.20 579,456 679 10.70
C++ g++ #3 12.38 215,640 859 17.95
C# aot #4 9.74 729,588 854 33.09
C++ g++   Make Error  
C++ g++ #2   Make Error  
C++ g++ #5   Make Error  
C++ g++ #4   Make Error  
C++ g++

g++ (Ubuntu 14.2.0-4ubuntu2) 14.2.0

C# aot

.NET SDK 9.0.100
Host Version: 9.0.0
Commit: 9d5a6a9aa4

<OutputType>Exe
<TargetFramework>net9.0
<ImplicitUsings>enable
<Nullable>enable
<AllowUnsafeBlocks>true
<ServerGarbageCollection>true
<ConcurrentGarbageCollection>true
<PublishAot>true
<OptimizationPreference>Speed
<IlcInstructionSet>native