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.76 36,616 1381 23.42 100% 1% 2% 1%
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 34,468 949 64.96 98% 97% 99% 95%
reverse-complement
source secs mem gz busy cpu load
OCaml 3.71 34,116 1368 8.66 65% 54% 54% 60%
F# .NET Core 2.94 1,031,376 1140 8.33 54% 37% 95% 97%
binary-trees
source secs mem gz busy cpu load
OCaml 10.01 152,708 751 29.55 69% 87% 56% 83%
F# .NET Core 6.99 918,992 631 24.34 88% 89% 86% 86%
regex-redux
source secs mem gz busy cpu load
OCaml 24.81 969,076 637 25.15 0% 1% 0% 100%
F# .NET Core 17.16 1,341,200 611 54.97 78% 78% 75% 89%
mandelbrot
source secs mem gz busy cpu load
OCaml 13.75 4,916 717 54.88 100% 100% 100% 100%
F# .NET Core 6.47 65,488 897 25.26 97% 100% 97% 97%
pidigits
source secs mem gz busy cpu load
OCaml 6.74 20,004 458 6.96 1% 1% 100% 1%
F# .NET Core 3.14 36,608 874 3.24 2% 98% 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.70 107,124 1350 6.41 93% 99% 94% 92%
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.21 34,304 853 16.04 98% 94% 94% 95%
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.97 183,292 1907 19.71 92% 72% 84% 83%
OCaml

The OCaml native-code compiler, version 4.08.0

F# .NET Core

Microsoft (R) F# Compiler version 10.6.0.0 for F# 4.7
.NET Core SDK 3.0.100
Host Version: 3.0.0; Commit: 95a0a61858
<ServerGarbageCollection>true
<ConcurrentGarbageCollection>true