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.75 ? 1314 ? 46% 53% 61% 52%
C++ g++ 0.60 211,852 2275 0.98 38% 25% 82% 27%
regex-redux
source secs mem gz cpu cpu load
OCaml 24.92 968,548 622 24.89 1% 1% 1% 100%
C++ g++ 17.14 220,088 853 25.22 95% 3% 51% 1%
fannkuch-redux
source secs mem gz cpu cpu load
OCaml 16.23 ? 1017 ? 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.36 5,072 907 15.48 92% 91% 93% 91%
C++ g++ 1.99 1,880 1044 7.89 100% 99% 99% 99%
n-body
source secs mem gz cpu cpu load
OCaml 21.67 1,276 1239 21.66 1% 100% 0% 1%
C++ g++ 9.31 1,052 1544 9.30 1% 1% 1% 100%
k-nucleotide
source secs mem gz cpu cpu load
OCaml 19.69 259,992 1789 54.82 71% 90% 50% 70%
C++ g++ 7.18 164,052 1252 24.28 83% 83% 93% 83%
fasta
source secs mem gz cpu cpu load
OCaml 5.89 201,740 1161 5.88 100% 1% 0% 2%
C++ g++ 1.48 4,176 2313 5.25 89% 90% 88% 89%
binary-trees
source secs mem gz cpu cpu load
OCaml 9.82 115,804 746 28.90 90% 96% 39% 72%
C++ g++ 2.36 114,404 809 7.69 86% 71% 87% 85%
mandelbrot
source secs mem gz cpu cpu load
OCaml 13.78 8,300 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.05.0

C++ g++

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