The Computer Language
Benchmarks Game

OCaml programs versus Java

by benchmark task performance

reverse-complement
source secs mem gz cpu cpu load
OCaml 0.79 ? 1368 ? 48% 59% 74% 58%
Java 1.03 191,064 2183 2.31 52% 57% 43% 74%
fannkuch-redux
source secs mem gz cpu cpu load
OCaml 16.12 ? 1017 ? 100% 100% 100% 100%
Java 17.26 32,116 1282 67.75 98% 99% 97% 99%
n-body
source secs mem gz cpu cpu load
OCaml 21.67 1,588 1251 21.67 61% 1% 0% 39%
Java 22.10 33,136 1429 22.20 31% 1% 1% 70%
spectral-norm
source secs mem gz cpu cpu load
OCaml 4.31 5,280 914 15.97 92% 94% 93% 92%
Java 4.23 34,472 950 16.27 96% 97% 97% 96%
binary-trees
source secs mem gz cpu cpu load
OCaml 10.03 115,968 751 30.17 89% 89% 82% 44%
Java 8.34 893,008 835 28.20 87% 79% 96% 81%
fasta
source secs mem gz cpu cpu load
OCaml 6.00 199,732 1189 5.99 0% 2% 100% 0%
Java 2.33 43,924 2473 6.07 53% 71% 63% 74%
mandelbrot
source secs mem gz cpu cpu load
OCaml 55.18 2,900 444 55.17 0% 1% 0% 100%
Java 6.04 76,528 796 23.34 98% 97% 97% 97%
pidigits
source secs mem gz cpu cpu load
OCaml   Make Error
Java 0.31 1,868 938 0.37 27% 14% 19% 72%
k-nucleotide
source secs mem gz cpu cpu load
OCaml   Make Error
Java 0.59 38,268 1812 1.46 48% 78% 73% 52%
regex-redux
source secs mem gz cpu cpu load
OCaml   Make Error
Java 0.62 45,052 929 1.84 86% 66% 72% 75%
OCaml

The OCaml native-code compiler, version 4.06.0

Java

java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)