The Computer Language
25.01 Benchmarks Game

C# .NET 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
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #5 2.16 6,484 1485 8.57
* C# .NET #5 2.36 33,604 1485 9.01—9.04
C# .NET #2 30.41 32,698 584 30.40
C# aot #2 31.30 6,124 584 31.25—31.41
C# aot #9 8.11 6,554 1232 32.34
* C# .NET #9 8.44 34,079 1232 33.38
C# .NET #6 9.95 33,268 1075 39.51
C# aot #6 10.13 6,734 1075 40.47
C# .NET #3 11.06 33,440 1117 43.78—44.71
C# aot #3 11.02 6,668 1117 43.57—43.65
C# .NET #8 43.85 32,874 519 43.84
C# aot #8 44.64 6,173 519 44.63
n-body
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #9 3.13 6,447 2480 3.12
* C# .NET #9 3.20 32,100 2480 3.18
C# aot #4 3.70 6,304 2137 3.70
* C# .NET #4 3.77 32,088 2137 3.75
C# aot #7 4.75 6,222 1715 3.90—7.35
C# aot #6 4.77 6,160 1754 4.03—7.01
* C# .NET #7 4.83 32,309 1715 4.16—6.83
* C# .NET #6 4.85 32,424 1754 4.84
C# aot 6.40 5,923 1424 6.40
C# aot #0 6.40 5,992 1342 6.40
C# .NET #0 6.49 33,673 1342 6.48
C# .NET 6.49 33,669 1424 6.48
C# .NET #3 6.68 33,300 1311 6.66
C# aot #3 6.67 6,185 1311 6.67
C# aot #2 6.81 5,865 1339 6.81
C# .NET #2 6.92 33,321 1339 6.91
C# aot #8 7.02 5,870 1335 7.02
C# .NET #8 7.24 32,903 1335 7.24
spectral-norm
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #5 0.74 8,331 776 2.88
* C# .NET #5 0.97 38,724 776 3.54—3.67
C# aot #8 5.35 6,959 441 5.34
C# .NET #8 5.43 33,440 441 5.41
C# aot #2 1.46 6,447 1084 5.72
C# aot #3 1.49 6,857 890 5.80
C# .NET #2 1.56 33,878 1084 4.24—6.30
C# .NET #3 1.57 35,738 890 5.82
mandelbrot
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #7 2.96 39,080 915 11.74
* C# .NET #7 3.23 72,647 915 12.50—12.73
C# aot #9 3.76 39,207 822 14.96
C# aot 3.77 39,244 1980 14.96
* C# .NET 3.96 70,394 1980 15.51—15.65
* C# .NET #9 3.97 70,390 822 15.46—15.57
C# .NET #5 4.08 68,473 851 15.89
C# aot #5 4.01 40,976 851 15.89
C# aot #8 25.58 6,009 492 25.56—25.65
C# .NET #8 26.42 33,997 492 26.42
C# aot #3 6.70 39,530 722 26.54
C# .NET #3 6.80 66,814 722 26.76—26.83
C# .NET #2 47.63 33,591 504 47.68—47.92
C# aot #2 47.80 6,349 504 48.04—48.28
fasta
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #9 1.16 6,365 1512 1.16
C# .NET #9 1.24 33,456 1512 1.23
C# aot #5 1.13 32,113 1702 4.29—4.42
C# .NET #5 1.52 50,909 1702 5.45—5.53
C# .NET #8 5.79 37,089 904 5.49
C# aot 1.64 11,018 2113 5.66—5.69
C# .NET 1.79 40,940 2113 6.29—6.51
C# aot #8 6.64 8,819 904 6.31
k-nucleotide
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot 3.13 160,223 2046 10.63—10.87
C# .NET 3.26 191,136 2046 10.90—11.07
C# aot #6 5.06 158,024 1615 13.11—13.65
C# .NET #6 5.70 189,485 1615 15.11—15.69
C# .NET #4 12.18 605,745 1725 43.18—44.85
C# .NET #7 42.84 612,524 1449 43.55—43.81
C# aot #4 13.17 530,817 1725 45.77—45.89
C# aot #7 47.98 593,002 1449 48.46—48.64
C# aot #8 84.18 1,359,630 736 75.73—76.86
C# .NET #8 86.82 1,411,391 736 79.04—80.19
reverse-complement
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #9 0.56 521,523 2641 1.36—1.40
C# .NET #9 0.70 550,724 2641 1.53
C# .NET 3.33 666,468 1130 3.32—3.36
C# aot 3.38 637,932 1130 3.40—3.45
C# aot #5 2.74 1,026,769 1620 3.77
C# .NET #5 2.60 1,056,993 1620 3.89
C# .NET #6 1.73 1,058,730 1627 4.04—4.10
C# aot #7 1.55 823,681 1312 4.11—4.23
C# aot #6 1.83 1,030,046 1627 4.30
C# .NET #7 1.71 797,377 1312 4.48—4.60
C# .NET #3 8.66 1,263,636 934 13.51—13.71
C# aot #3 8.80 1,238,057 934 13.37—13.53
binary-trees
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# .NET #8 16.33 764,305 601 16.70—16.96
C# aot #7 6.23 1,141,314 706 17.18—17.83
C# aot #2 6.17 1,118,659 717 17.16—17.79
C# aot #8 17.32 828,428 601 17.34—17.53
C# aot #3 6.69 2,861,916 688 17.96—18.62
C# .NET #7 6.44 1,047,609 706 18.15—18.50
C# .NET #2 6.42 1,086,042 717 18.20—18.47
C# aot 6.81 2,842,558 668 18.75—19.09
C# .NET 7.22 3,210,469 668 20.34—20.58
C# .NET #3 7.41 2,884,338 688 20.67—20.95
C# aot #6   Empty  
C# .NET #6   Empty  
pidigits
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #6 0.75 7,893 1182 0.75
* C# .NET #6 0.84 35,021 1182 0.83
* C# .NET #5 0.87 37,380 990 0.89
* C# .NET #4 1.32 35,627 1135 1.30
C# aot #4 4.54 8,004 1135 4.53
C# aot #7 11.82 10,072 579 8.36—9.30
C# .NET #7 11.24 44,225 579 9.38—10.47
C# aot #5 99.08 8,438 990 99.09
regex-redux
  elapsed     Mean or 95% CI
source secs mem gz cpu secs
C# aot #2 1.36 320,348 1881 2.55
C# .NET #2 1.43 402,608 1881 2.64
C# .NET 4.61 618,942 641 4.83
C# .NET #5 1.90 631,972 679 5.20—5.38
C# aot 10.72 582,566 641 10.74—10.81
C# aot #5 3.24 596,681 679 10.73—10.78
C# .NET #4 8.60 881,631 854 30.06—32.39
C# aot #4 9.76 743,420 854 33.02—33.13
C# .NET

.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>false

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