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.74 ? 1314 ? 63% 61% 42% 57%
C++ g++ 0.59 217,564 2275 0.84 26% 78% 12% 34%
fannkuch-redux
source secs mem gz cpu cpu load
OCaml 16.14 ? 1017 ? 100% 100% 100% 100%
C++ g++ 10.58 2,520 950 41.88 100% 100% 99% 98%
spectral-norm
source secs mem gz cpu cpu load
OCaml 4.46 4,792 907 15.50 90% 93% 88% 90%
C++ g++ 2.01 1,792 1044 8.00 100% 100% 100% 100%
n-body
source secs mem gz cpu cpu load
OCaml 21.69 1,084 1239 21.68 1% 1% 100% 1%
C++ g++ 9.30 1,712 1763 9.29 100% 1% 1% 0%
mandelbrot
source secs mem gz cpu cpu load
OCaml 13.78 7,800 710 54.76 100% 100% 100% 99%
C++ g++ 5.82 33,952 726 22.40 96% 95% 95% 100%
k-nucleotide
source secs mem gz cpu cpu load
OCaml 19.76 256,940 1789 54.18 43% 96% 43% 94%
C++ g++ 7.15 164,080 1252 24.21 82% 83% 80% 96%
fasta
source secs mem gz cpu cpu load
OCaml 5.79 202,460 1161 5.79 1% 2% 100% 1%
C++ g++ 1.47 9,484 2291 5.13 88% 88% 87% 88%
binary-trees
source secs mem gz cpu cpu load
OCaml 23.42 173,568 784 70.56 84% 90% 77% 55%
C++ g++ 3.36 158,320 846 10.59 81% 82% 78% 75%
regex-redux
source secs mem gz cpu cpu load
OCaml   Bad Output
C++ g++ 0.08 ? 700 0.12 13% 0% 50% 89%
pidigits
source secs mem gz cpu cpu load
OCaml   Make Error
C++ g++ 0.07 ? 508 0.07 0% 13% 100% 0%
OCaml

The OCaml native-code compiler, version 4.04.0

C++ g++

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