The Computer Language
Benchmarks Game

OCaml programs versus C++ g++

by benchmark task performance

reverse-complement
source secs mem gz cpu cpu load
OCaml 1.84 265,208 2064 1.83 1% 1% 1% 100%
C++ g++ 1.02 247,604 2275 1.01 2% 0% 0% 100%
k-nucleotide
source secs mem gz cpu cpu load
OCaml 5.45 61,824 870 5.44 1% 1% 0% 100%
C++ g++ 3.01 24,472 1252 2.67 1% 2% 1% 100%
spectral-norm
source secs mem gz cpu cpu load
OCaml 18.93 4,588 907 17.98 0% 1% 1% 100%
C++ g++ 7.93 2,288 1044 7.92 1% 1% 0% 100%
fasta
source secs mem gz cpu cpu load
OCaml 10.10 2,124 1042 10.10 1% 0% 0% 100%
C++ g++ 4.21 1,336 1105 4.20 1% 1% 0% 100%
fannkuch-redux
source secs mem gz cpu cpu load
OCaml 84.12 912 473 84.09 1% 0% 0% 100%
C++ g++ 24.65 556 1150 24.64 1% 1% 0% 100%
mandelbrot
source secs mem gz cpu cpu load
OCaml 85.09 3,584 710 84.94 0% 1% 1% 100%
C++ g++ 20.11 33,768 726 20.10 0% 1% 1% 100%
binary-trees
source secs mem gz cpu cpu load
OCaml 34.05 139,200 496 34.00 0% 1% 1% 100%
C++ g++ 6.86 76,616 846 6.85 0% 1% 0% 100%
n-body
source secs mem gz cpu cpu load
OCaml 66.45 912 1239 66.43 0% 1% 1% 100%
C++ g++ 8.96 816 1545 8.95 1% 1% 0% 100%
pidigits
source secs mem gz cpu cpu load
OCaml   Make Error
C++ g++ 0.09 ? 508 0.09 0% 0% 10% 100%
OCaml

The OCaml native-code compiler, version 4.03.0

C++ g++

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609