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.79 ? 1368 ? 48% 59% 74% 58%
C++ g++ 0.64 247,800 2280 1.03 89% 22% 31% 30%
fannkuch-redux
source secs mem gz cpu cpu load
OCaml 16.12 ? 1017 ? 100% 100% 100% 100%
C++ g++ 10.61 2,044 980 41.90 100% 96% 100% 100%
spectral-norm
source secs mem gz cpu cpu load
OCaml 4.31 5,280 914 15.97 92% 94% 93% 92%
C++ g++ 2.02 1,332 1044 7.91 99% 99% 99% 99%
n-body
source secs mem gz cpu cpu load
OCaml 21.67 1,588 1251 21.67 61% 1% 0% 39%
C++ g++ 8.23 1,856 1763 8.23 100% 1% 1% 0%
binary-trees
source secs mem gz cpu cpu load
OCaml 10.03 115,968 751 30.17 89% 89% 82% 44%
C++ g++ 2.55 135,568 809 7.99 85% 96% 69% 66%
fasta
source secs mem gz cpu cpu load
OCaml 6.00 199,732 1189 5.99 0% 2% 100% 0%
C++ g++ 1.49 4,372 2324 5.28 89% 88% 90% 90%
mandelbrot
source secs mem gz cpu cpu load
OCaml 55.18 2,900 444 55.17 0% 1% 0% 100%
C++ g++ 1.64 27,636 1002 6.51 100% 99% 100% 99%
pidigits
source secs mem gz cpu cpu load
OCaml   Make Error
C++ g++ 0.07 ? 513 0.07 0% 0% 86% 13%
k-nucleotide
source secs mem gz cpu cpu load
OCaml   Make Error
C++ g++ 0.41 740 1276 0.73 30% 38% 93% 28%
regex-redux
source secs mem gz cpu cpu load
OCaml   Make Error
C++ g++ 0.02 ? 1315 0.06 100% 50% 67% 100%
OCaml

The OCaml native-code compiler, version 4.06.0

C++ g++

g++ (Ubuntu 7.2.0-8ubuntu3) 7.2.0