The Computer Language
24.11 Benchmarks Game

C# .NET versus F# .NET 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# .NET #5 2.27 29,584 1485 8.79
C# .NET #2 30.38 28,804 584 30.37
F# .NET #6 8.34 34,272 1103 32.44
* C# .NET #9 8.40 29,608 1232 33.33
F# .NET #5 9.74 39,392 927 38.29
C# .NET #6 9.93 29,272 1075 39.49
C# .NET #3 11.01 29,020 1117 43.46
C# .NET #8 43.80 28,760 519 43.78
F# .NET 99.33 40,016 558 98.70
n-body
source secs mem gz cpu secs
* C# .NET #9 3.17 28,604 2480 3.17
* C# .NET #4 3.75 28,504 2137 3.75
* C# .NET #7 4.80 28,564 1715 4.80
* C# .NET #6 4.83 28,512 1754 4.83
* F# .NET #6 4.98 36,720 1395 4.97
* F# .NET #5 5.84 36,696 1363 5.84
C# .NET #3 6.65 29,280 1311 6.64
C# .NET #2 6.89 29,284 1339 6.89
F# .NET #4 6.91 36,692 1296 6.91
F# .NET #3 6.95 35,516 1624 6.95
C# .NET #8 7.21 29,068 1335 7.21
F# .NET #2 7.33 36,804 1387 7.33
C# .NET #0 7.66 29,360 1342 7.66
C# .NET 7.66 29,380 1424 7.66
F# .NET 7.94 39,668 1272 7.93
spectral-norm
source secs mem gz cpu secs
* F# .NET #6 0.94 39,412 697 3.41
* C# .NET #5 0.94 33,752 776 3.42
C# .NET #8 5.41 29,720 441 5.40
C# .NET #2 1.52 29,864 1084 5.78
C# .NET #3 1.54 31,460 890 5.80
F# .NET #4 1.57 38,892 738 5.85
F# .NET #2   Timed Out  
mandelbrot
source secs mem gz cpu secs
* C# .NET #7 3.21 66,484 915 12.50
* C# .NET 3.93 64,440 1980 15.41
* C# .NET #9 3.93 64,332 822 15.45
C# .NET #5 4.06 63,344 851 15.87
* F# .NET #6 4.17 69,016 943 16.28
* F# .NET 4.39 69,508 890 17.25
C# .NET #8 26.41 29,820 492 26.41
C# .NET #3 6.79 61,964 722 26.79
F# .NET #2 7.11 41,304 1054 27.99
C# .NET #2 46.19 29,604 504 46.19
fasta
source secs mem gz cpu secs
C# .NET #9 1.21 29,432 1512 1.21
F# .NET #3 1.12 64,832 1361 4.03
F# .NET #4 1.40 65,484 1355 5.22
C# .NET #8 5.40 32,864 904 5.42
C# .NET #5 1.48 50,620 1702 5.45
C# .NET 1.70 36,636 2113 6.23
k-nucleotide
source secs mem gz cpu secs
C# .NET 3.18 181,724 2046 10.77
F# .NET #6 3.71 188,232 1913 11.97
C# .NET #6 5.63 180,500 1615 14.88
F# .NET #5 4.62 202,244 1964 15.77
F# .NET #2 4.79 202,524 1932 16.18
F# .NET #3 12.67 1,318,584 1124 28.91
F# .NET #4 11.31 1,316,416 1522 30.18
C# .NET #4 12.06 612,408 1725 42.10
C# .NET #7 42.74 613,184 1449 43.35
C# .NET #8 75.28 1,370,624 736 76.44
F# .NET 27.63 910,836 713 89.96
reverse-complement
source secs mem gz cpu secs
C# .NET #9 0.59 733,932 2641 1.37
C# .NET 3.14 583,252 1130 3.18
C# .NET #6 1.55 1,027,196 1627 3.76
C# .NET #5 2.53 1,025,008 1620 3.83
C# .NET #7 1.54 927,984 1312 4.25
C# .NET #3 8.47 1,380,908 934 13.21
F# .NET 39.89 3,000,744 603 41.18
F# .NET #4   Timed Out  
F# .NET #5   Timed Out  
binary-trees
source secs mem gz cpu secs
F# .NET 11.60 1,036,652 517 13.72
C# .NET #8 13.50 883,524 601 15.31
C# .NET #7 5.34 1,074,228 706 17.42
C# .NET #2 5.37 1,083,480 717 17.60
C# .NET 6.11 3,178,448 668 19.93
C# .NET #3 6.45 2,900,008 688 20.33
F# .NET #7 7.58 988,852 527 21.64
C# .NET #6   Make Error  
pidigits
source secs mem gz cpu secs
* C# .NET #6 0.82 30,744 1182 0.82
* F# .NET #6 0.82 34,472 917 0.82
* C# .NET #5 0.84 33,264 990 0.88
* C# .NET #4 1.29 31,392 1135 1.29
* F# .NET #4 1.29 35,924 887 1.32
C# .NET #7 7.15 38,160 579 7.25
regex-redux
source secs mem gz cpu secs
C# .NET #2 1.36 402,516 1881 2.60
C# .NET 4.60 599,212 641 4.83
F# .NET #2 4.72 850,784 437 4.97
C# .NET #5 1.74 614,536 679 5.02
F# .NET #6 1.77 767,564 622 5.11
F# .NET #7 4.58 662,224 610 6.41
C# .NET #4 8.65 854,996 854 29.97
F# .NET   Bad Output  
F# .NET #4   Bad Output  
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

F# .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