The Computer Language
24.11 Benchmarks Game

OCaml 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
F# .NET #6 8.34 34,272 1103 32.44
OCaml #3 8.80 19,676 1024 35.18
OCaml #4 9.13 19,676 1018 36.46
F# .NET #5 9.74 39,392 927 38.29
OCaml #2 45.76 19,676 478 45.76
OCaml 51.25 19,676 529 51.25
F# .NET 99.33 40,016 558 98.70
n-body
source secs mem gz cpu secs
* F# .NET #6 4.98 36,720 1395 4.97
* F# .NET #5 5.84 36,696 1363 5.84
F# .NET #4 6.91 36,692 1296 6.91
OCaml 6.94 19,676 1255 6.94
F# .NET #3 6.95 35,516 1624 6.95
F# .NET #2 7.33 36,804 1387 7.33
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
OCaml #2 5.32 19,676 383 5.32
F# .NET #4 1.57 38,892 738 5.85
F# .NET #2   Timed Out  
mandelbrot
source secs mem gz cpu secs
* F# .NET #6 4.17 69,016 943 16.28
* F# .NET 4.39 69,508 890 17.25
F# .NET #2 7.11 41,304 1054 27.99
OCaml #6 28.76 19,676 450 28.76
OCaml 7.59 19,676 723 30.20
fasta
source secs mem gz cpu secs
OCaml #6 3.36 201,984 1194 3.36
F# .NET #3 1.12 64,832 1361 4.03
OCaml #3 4.71 19,676 1075 4.71
F# .NET #4 1.40 65,484 1355 5.22
k-nucleotide
source secs mem gz cpu secs
F# .NET #6 3.71 188,232 1913 11.97
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
* OCaml #3 16.29 258,556 1839 43.41
* OCaml 45.59 338,436 894 45.59
* OCaml #2 27.45 314,312 1247 61.90
F# .NET 27.63 910,836 713 89.96
reverse-complement
source secs mem gz cpu secs
* OCaml 2.25 19,676 1372 5.09
OCaml #3 2.28 19,676 1361 5.77
OCaml #2 9.27 909,056 426 9.27
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
OCaml #5 7.80 221,952 468 7.80
OCaml #2 3.59 216,628 759 10.35
F# .NET 11.60 1,036,652 517 13.72
F# .NET #7 7.58 988,852 527 21.64
pidigits
source secs mem gz cpu secs
* F# .NET #6 0.82 34,472 917 0.82
* F# .NET #4 1.29 35,924 887 1.32
OCaml #5 2.75 19,676 465 2.75
OCaml #7   Make Error  
regex-redux
source secs mem gz cpu secs
* OCaml #3 2.20 451,620 653 3.35
F# .NET #2 4.72 850,784 437 4.97
F# .NET #6 1.77 767,564 622 5.11
F# .NET #7 4.58 662,224 610 6.41
* OCaml #2 13.99 922,636 644 13.99
F# .NET   Bad Output  
F# .NET #4   Bad Output  
OCaml

OCaml native-code
5.4.0+dev0-2024-08-25

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