The Computer Language
Benchmarks Game

OCaml versus F# .NET Core fastest programs

Back in April 2010, Russ Cox charitably suggested that only fannkuch-redux, fasta, k-nucleotide, mandlebrot, nbody, reverse-complement and spectral-norm were close to fair comparisons. As someone who implemented programming languages, his interest was "measuring the quality of the generated code when both compilers are presented with what amounts to the same program."

Differences in approach - to memory management, parallel programming, regex, arbitrary precision arithmetic, implementation technique - don't fit in that kind-of fair comparison — but we still have to deal with them.

These are only the fastest programs. There may be additional measurements for programs which seem more-like a fair comparison to you. Always look at the source code.

n-body
source secs mem gz busy cpu load
OCaml 21.69 1,496 1251 22.18 0% 100% 2% 0%
F# .NET Core 22.94 39,152 1381 23.33 1% 0% 1% 100%
fannkuch-redux
source secs mem gz busy cpu load
OCaml 16.33 28,692 1017 65.22 100% 100% 100% 100%
F# .NET Core 16.75 37,412 924 65.35 95% 98% 98% 99%
reverse-complement
source secs mem gz busy cpu load
OCaml 3.71 34,116 1368 8.66 65% 54% 54% 60%
F# .NET Core 3.06 1,035,904 1140 8.52 89% 42% 91% 57%
binary-trees
source secs mem gz busy cpu load
OCaml 10.01 152,708 751 29.55 69% 87% 56% 83%
F# .NET Core 8.03 1,044,600 631 26.86 85% 89% 80% 81%
regex-redux
source secs mem gz busy cpu load
OCaml 24.81 969,076 637 25.15 0% 1% 0% 100%
F# .NET Core 14.10 1,497,456 611 46.88 82% 73% 81% 96%
mandelbrot
source secs mem gz busy cpu load
OCaml 13.75 4,916 717 54.88 100% 100% 100% 100%
F# .NET Core 6.70 67,412 897 26.27 98% 97% 97% 99%
pidigits
source secs mem gz busy cpu load
OCaml 6.74 20,004 458 6.96 1% 1% 100% 1%
F# .NET Core 3.11 37,908 874 3.18 0% 100% 2% 1%
fasta
source secs mem gz busy cpu load
OCaml 6.08 197,120 1189 6.17 0% 0% 1% 100%
F# .NET Core 1.68 99,404 1350 6.16 94% 89% 89% 95%
spectral-norm
source secs mem gz busy cpu load
OCaml 15.70 3,716 377 16.03 1% 1% 100% 0%
F# .NET Core 4.16 37,496 730 16.02 96% 95% 95% 99%
k-nucleotide
source secs mem gz busy cpu load
OCaml 22.37 255,584 1833 62.55 49% 48% 89% 93%
F# .NET Core 5.89 185,148 1907 19.63 92% 87% 89% 65%
OCaml

The OCaml native-code compiler, version 4.08.0

F# .NET Core

Microsoft (R) F# Compiler version 10.4.0 for F# 4.6
.NET Core SDK 2.2.202
Host Version: 2.2.3; Commit: 6b8ad509b6
<ServerGarbageCollection>true
<ConcurrentGarbageCollection>true