The Computer Language
Benchmarks Game

OCaml programs versus C++ g++

by benchmark task performance

reverse-complement
source secs mem gz cpu cpu load
OCaml 3.73 ? 1368 ? 56% 62% 55% 58%
C++ g++ 3.08 980,604 2280 4.66 62% 25% 12% 54%
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%
k-nucleotide
source secs mem gz cpu cpu load
OCaml 21.63 255,436 1833 57.55 47% 39% 94% 89%
C++ g++ 7.75 165,180 1276 26.02 80% 96% 82% 79%
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.35 1,952 2711 4.18 79% 78% 78% 79%
regex-redux
source secs mem gz cpu cpu load
OCaml 24.66 968,800 637 24.64 1% 1% 0% 100%
C++ g++ 1.61 203,572 1315 4.18 100% 52% 57% 54%
mandelbrot
source secs mem gz cpu cpu load
OCaml 55.18 2,900 444 55.17 0% 1% 0% 100%
C++ g++ 1.51 25,704 1791 5.99 99% 100% 100% 100%
pidigits
source secs mem gz cpu cpu load
OCaml   Make Error
C++ g++ 0.07 ? 513 0.07 0% 0% 86% 13%
OCaml

The OCaml native-code compiler, version 4.06.0

C++ g++

g++ (Ubuntu 7.2.0-8ubuntu3) 7.2.0