language-bench

OCaml

OCaml compiled to native code by ocamlopt: strict, statically typed, with a fast generational garbage collector and an optimiser that does little inlining unless flambda is enabled.

ocaml.org ↗
Overall speed rank
-
no data yet
Latest release
5.6
5 tracked releases since 2022
Strongest on
-
Weakest on
-

Performance by problem

Newest release (5.6), default build (ocamlopt -O3 -unsafe). The index is how many times slower this language is than the fastest entry on that problem (1.00× = fastest); rank is among all languages.

No benchmark sessions have been recorded yet.

The first scheduled GitHub Actions run will publish real measurements here. Everything on this page is computed from raw iterations in data/.

Build settings

ocamlopt -O3 -unsafe default

Native code without bounds checks (-unsafe); -O3 only matters on flambda compilers.

mkdir -p {bin}.o && cp {harness}/harness.ml {src}/main.ml {bin}.o/ && cd {bin}.o && mv main.ml problem.ml && ocamlopt -O3 -unsafe -inline 200 -I +unix unix.cmxa problem.ml harness.ml -o {bin}{bin}

ocamlopt

Native code with bounds checking (the default).

mkdir -p {bin}.o && cp {harness}/harness.ml {src}/main.ml {bin}.o/ && cd {bin}.o && mv main.ml problem.ml && ocamlopt -I +unix unix.cmxa problem.ml harness.ml -o {bin}{bin}

Every release (default build)

No benchmark sessions have been recorded yet.

The first scheduled GitHub Actions run will publish real measurements here. Everything on this page is computed from raw iterations in data/.

Speed across releases

Did OCaml get faster? Every tracked release plotted at its release date, one line per build setting. Shows time, memory or binary size over all problems by default.

No benchmark sessions have been recorded yet.

The first scheduled GitHub Actions run will publish real measurements here. Everything on this page is computed from raw iterations in data/.

Release highlights

  1. OCaml 5.4 2025-10-09
  2. OCaml 5.2 2024-05-13
  3. OCaml 5.0 2022-12-16
  4. OCaml 4.14 2022-03-28
  5. OCaml 5.6

Badge

Show this language's overall rank in your README or website:

PreviewOCaml rank on language-bench
Markdown[![OCaml on language-bench](https://stijnris.github.io/language-bench/badges/ocaml.svg)](https://stijnris.github.io/language-bench/languages/ocaml/)
HTML<a href="https://stijnris.github.io/language-bench/languages/ocaml/"><img src="https://stijnris.github.io/language-bench/badges/ocaml.svg" alt="OCaml on language-bench"></a>