The Computer Language
Benchmarks Game

F# .NET Core versus OCaml 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.

spectral-norm
source secs mem gz busy cpu load
F# .NET Core 4.11 34,960 853 15.91 96% 99% 97% 96%
OCaml 15.70 3,744 377 16.33 1% 3% 0% 100%
k-nucleotide
source secs mem gz busy cpu load
F# .NET Core 5.97 183,292 1907 19.71 92% 72% 84% 83%
OCaml 22.37 255,604 1833 61.94 40% 97% 46% 94%
fasta
source secs mem gz busy cpu load
F# .NET Core 1.70 107,124 1350 6.41 93% 99% 94% 92%
OCaml 6.11 202,384 1189 6.22 0% 100% 1% 1%
pidigits
source secs mem gz busy cpu load
F# .NET Core 1.88 35,788 905 1.94 2% 2% 1% 98%
OCaml 6.74 20,108 458 7.00 1% 3% 100% 0%
regex-redux
source secs mem gz busy cpu load
F# .NET Core 8.03 1,069,132 599 11.16 53% 37% 32% 16%
OCaml 25.43 969,092 637 25.60 100% 0% 0% 0%
mandelbrot
source secs mem gz busy cpu load
F# .NET Core 6.47 65,488 897 25.26 97% 100% 97% 97%
OCaml 13.84 5,004 717 55.24 100% 100% 100% 100%
binary-trees
source secs mem gz busy cpu load
F# .NET Core 6.99 918,992 631 24.34 88% 89% 86% 86%
OCaml 9.84 152,916 751 29.09 84% 43% 99% 69%
reverse-complement
source secs mem gz busy cpu load
F# .NET Core 2.94 1,031,376 1140 8.33 54% 37% 95% 97%
OCaml 3.78 33,952 1368 8.78 60% 55% 58% 60%
fannkuch-redux
source secs mem gz busy cpu load
F# .NET Core 16.75 34,468 949 64.96 98% 97% 99% 95%
OCaml 16.39 28,836 1017 65.51 100% 100% 100% 100%
n-body
source secs mem gz busy cpu load
F# .NET Core 22.76 36,616 1381 23.42 100% 1% 2% 1%
OCaml 21.68 1,556 1251 21.91 0% 1% 0% 100%
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

OCaml

The OCaml native-code compiler, version 4.09.0