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
 regex-dna1/211×±
 reverse-complement †1/21/11±
 k-nucleotide±±
 pidigits †± 
 binary-trees±1/4±
 spectral-norm± ±
 n-body 1/2
 fannkuch-redux ±
 mandelbrot ±
 fasta † 1/2
 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
 regex-dna 
OCaml0.140.56445,1881050  75% 75% 78% 98%
Haskell GHC3.881.1841,3401518  87% 85% 85% 76%
 reverse-complement 
OCaml0.000.8912,6441314  52% 57% 83% 67% †
Haskell GHC1.561.46134,216999  2% 100% 3% 2% †
 k-nucleotide 
OCaml6.002.40228,0721789  36% 37% 88% 93%
Haskell GHC9.362.9654,4161965  79% 81% 80% 80%
 pidigits 
OCaml3.803.815,700560  0% 0% 1% 100% †
Haskell GHC4.913.4812,272341  100% 14% 15% 14% †
 binary-trees 
OCaml40.1416.27101,028784  36% 95% 49% 69%
Haskell GHC40.4113.66405,572612  67% 99% 67% 66%
 spectral-norm 
OCaml18.245.273,232938  87% 97% 95% 85%
Haskell GHC16.084.151,392984  95% 97% 99% 97%
 n-body 
OCaml49.9249.935961239  0% 0% 0% 100%
Haskell GHC27.1026.373,6441874  100% 2% 1% 2%
 fannkuch-redux 
OCaml0.0026.4218,6961017  100% 100% 100% 100%
Haskell GHC54.3613.893,4241153  98% 98% 100% 95%
 mandelbrot 
OCaml150.0337.713,736710  100% 100% 100% 99%
Haskell GHC55.7313.9734,212782  100% 100% 100% 100%
 fasta 
OCaml12.1612.171,6561042  1% 0% 1% 100% †
Haskell GHC6.052.2113,2161567  61% 61% 91% 62% †
 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.01.0

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

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

Revised BSD license

  Home   Conclusions   License   Play