1 : Are the OCaml programs faster? At a glance.

Each chart bar shows, for one unidentified benchmark, how much the fastest OCaml program used compared to the fastest Haskell GHC program.

(Memory use is only compared for tasks that require memory to be allocated.)


These are not the only compilers and interpreters. These are not the only programs that could be written. These are not the only tasks that could be solved. These are just 10 tiny examples.

 2 : Are the OCaml programs faster? Approximately.

Each table row shows, for one named benchmark, how much the fastest OCaml program used compared to the fastest Haskell GHC program.

(Memory use is only compared for tasks that require memory to be allocated.)

 OCaml used what fraction? used how many times more? 
Benchmark Time Memory Code
 reverse-complement †1/21/4±
 regex-dna±±±
 fannkuch-redux± ±
 n-body± 1/2
 pidigits †± 
 spectral-norm± ±
 binary-trees±1/4±
 mandelbrot± ±
 k-nucleotide±±±
 fasta † ±
 OCaml used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/21/2±±±

† possible mismatch - one-core program compared to multi-core program.

± read the measurements and then read the program source code.

 3 : Are the OCaml programs faster? Measurements.

These are not the only tasks that could be solved. These are just 10 tiny examples. These are not the only compilers and interpreters. These are not the only programs that could be written.

For each named benchmark, measurements of the fastest OCaml program are shown for comparison against measurements of the fastest Haskell GHC program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 reverse-complement 
OCaml0.000.7331,4361314  47% 47% 52% 70% †
Haskell GHC1.521.36129,412999  3% 5% 4% 100% †
 regex-dna 
OCaml1.399.43268,4801050  83% 83% 83% 100%
Haskell GHC42.1711.06257,1081518  93% 96% 96% 96%
 fannkuch-redux 
OCaml0.0116.2522,3081017  100% 100% 100% 100%
Haskell GHC68.2317.368,080834  100% 99% 99% 96%
 n-body 
OCaml22.2622.277081239  1% 0% 100% 1%
Haskell GHC24.4023.176,8041874  3% 2% 3% 100%
 pidigits 
OCaml2.832.839,192560  1% 0% 0% 100% †
Haskell GHC3.972.7010,304341  18% 100% 17% 18% †
 spectral-norm 
OCaml16.024.313,496938  93% 94% 93% 92%
Haskell GHC15.704.055,788984  95% 97% 99% 97%
 binary-trees 
OCaml70.9124.46202,980784  72% 75% 58% 86%
Haskell GHC66.7220.72830,536612  75% 80% 94% 75%
 mandelbrot 
OCaml54.8913.785,492710  100% 100% 100% 100%
Haskell GHC45.8111.4941,208782  100% 100% 100% 100%
 k-nucleotide 
OCaml54.0720.22362,3241789  93% 88% 40% 49%
Haskell GHC61.0916.46276,5481693  92% 97% 92% 92%
 fasta 
OCaml6.046.05200,8721161  1% 1% 100% 0% †
Haskell GHC7.613.3213,5481567  54% 54% 52% 70% †
 fasta-redux
   No programs

† possible mismatch - one-core program compared to multi-core program.

 4 : Are there other OCaml programs for these benchmarks?

Remember - those are just the fastest OCaml and Haskell GHC programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for OCaml.

Maybe one of those other OCaml programs is fastest on a different OS/machine.

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest OCaml and Haskell GHC programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 OCaml : modular type-safe strict functional programming plus objects 

The OCaml native-code compiler, version 4.02.1

Home Page: http://www.ocaml.org/

Download: http://caml.inria.fr/download.en.html

Revised BSD license

  Home   Conclusions   License   Play