The Computer Language
Benchmarks Game

Java programs versus OCaml

by benchmark task performance

mandelbrot
source secs mem gz cpu cpu load
Java 6.04 76,528 796 23.34 98% 97% 97% 97%
OCaml 55.18 2,900 444 55.17 0% 1% 0% 100%
fasta
source secs mem gz cpu cpu load
Java 2.33 43,924 2473 6.07 53% 71% 63% 74%
OCaml 6.00 199,732 1189 5.99 0% 2% 100% 0%
k-nucleotide
source secs mem gz cpu cpu load
Java 8.70 375,568 1812 27.17 80% 72% 74% 88%
OCaml 21.63 255,436 1833 57.55 47% 39% 94% 89%
regex-redux
source secs mem gz cpu cpu load
Java 10.34 627,224 929 29.88 74% 72% 65% 79%
OCaml 24.66 968,800 637 24.64 1% 1% 0% 100%
binary-trees
source secs mem gz cpu cpu load
Java 8.34 893,008 835 28.20 87% 79% 96% 81%
OCaml 10.03 115,968 751 30.17 89% 89% 82% 44%
spectral-norm
source secs mem gz cpu cpu load
Java 4.23 34,472 950 16.27 96% 97% 97% 96%
OCaml 4.31 5,280 914 15.97 92% 94% 93% 92%
n-body
source secs mem gz cpu cpu load
Java 22.10 33,136 1429 22.20 31% 1% 1% 70%
OCaml 21.67 1,588 1251 21.67 61% 1% 0% 39%
fannkuch-redux
source secs mem gz cpu cpu load
Java 17.26 32,116 1282 67.75 98% 99% 97% 99%
OCaml 16.12 ? 1017 ? 100% 100% 100% 100%
reverse-complement
source secs mem gz cpu cpu load
Java 1.03 191,064 2183 2.31 52% 57% 43% 74%
OCaml 0.79 ? 1368 ? 48% 59% 74% 58%
pidigits
source secs mem gz cpu cpu load
Java 0.31 1,868 938 0.37 27% 14% 19% 72%
OCaml   Make Error
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)

OCaml

The OCaml native-code compiler, version 4.06.0