The Computer Language
Benchmarks Game

OCaml programs versus Java

by benchmark task performance

reverse-complement
source secs mem gz cpu cpu load
OCaml 1.84 265,208 2064 1.83 1% 1% 1% 100%
Java 1.79 521,988 745 1.78 1% 2% 2% 100%
spectral-norm
source secs mem gz cpu cpu load
OCaml 18.93 4,588 907 17.98 0% 1% 1% 100%
Java 16.30 23,872 950 16.29 1% 0% 1% 100%
k-nucleotide
source secs mem gz cpu cpu load
OCaml 5.45 61,824 870 5.44 1% 1% 0% 100%
Java 4.52 91,200 1802 4.37 2% 0% 0% 100%
fannkuch-redux
source secs mem gz cpu cpu load
OCaml 84.12 912 473 84.09 1% 0% 0% 100%
Java 67.02 23,380 1257 67.00 0% 1% 1% 100%
binary-trees
source secs mem gz cpu cpu load
OCaml 34.05 139,200 496 34.00 0% 1% 1% 100%
Java 16.53 511,692 584 16.51 1% 1% 0% 100%
fasta
source secs mem gz cpu cpu load
OCaml 10.10 2,124 1042 10.10 1% 0% 0% 100%
Java 4.77 23,400 1507 4.76 1% 1% 1% 100%
n-body
source secs mem gz cpu cpu load
OCaml 66.45 912 1239 66.43 0% 1% 1% 100%
Java 24.07 23,184 1430 24.06 1% 1% 1% 100%
mandelbrot
source secs mem gz cpu cpu load
OCaml 85.09 3,584 710 84.94 0% 1% 1% 100%
Java 27.41 55,556 796 27.40 1% 0% 1% 100%
pidigits
source secs mem gz cpu cpu load
OCaml   Make Error
Java 0.34 492 938 0.32 3% 3% 0% 100%
OCaml

The OCaml native-code compiler, version 4.03.0

Java

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) Server VM (build 25.92-b14, mixed mode)