The Computer Language
Benchmarks Game

OCaml programs versus C++ g++

by benchmark task performance

reverse-complement
source secs mem gz cpu cpu load
OCaml 0.76 ? 1314 ? 46% 58% 57% 49%
C++ g++ 0.60 211,852 2275 0.98 38% 25% 82% 27%
regex-redux
source secs mem gz cpu cpu load
OCaml 25.09 968,516 622 25.06 1% 54% 0% 46%
C++ g++ 17.14 220,088 853 25.22 95% 3% 51% 1%
fannkuch-redux
source secs mem gz cpu cpu load
OCaml 16.52 ? 1004 ? 100% 100% 100% 100%
C++ g++ 10.35 2,624 980 40.60 99% 99% 100% 95%
spectral-norm
source secs mem gz cpu cpu load
OCaml 4.35 5,008 907 15.54 90% 93% 93% 93%
C++ g++ 1.99 1,880 1044 7.89 100% 99% 99% 99%
n-body
source secs mem gz cpu cpu load
OCaml 21.68 1,252 1239 21.67 0% 0% 100% 1%
C++ g++ 9.31 1,052 1544 9.30 1% 1% 1% 100%
k-nucleotide
source secs mem gz cpu cpu load
OCaml 20.02 261,944 1789 56.21 48% 91% 95% 48%
C++ g++ 7.18 164,052 1252 24.28 83% 83% 93% 83%
fasta
source secs mem gz cpu cpu load
OCaml 5.88 200,032 1161 5.88 3% 100% 1% 1%
C++ g++ 1.48 4,176 2313 5.25 89% 90% 88% 89%
binary-trees
source secs mem gz cpu cpu load
OCaml 9.95 115,760 746 29.67 99% 73% 41% 87%
C++ g++ 2.36 114,404 809 7.69 86% 71% 87% 85%
mandelbrot
source secs mem gz cpu cpu load
OCaml 13.76 8,240 710 54.76 100% 100% 100% 100%
C++ g++ 1.73 34,064 1002 6.80 98% 98% 98% 99%
pidigits
source secs mem gz cpu cpu load
OCaml   Make Error
C++ g++ 0.07 ? 508 0.07 0% 0% 89% 0%
OCaml

The OCaml native-code compiler, version 4.04.0

C++ g++

g++ (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406