[Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

Jon Harrop jon at ffconsultancy.com
Fri Jun 22 22:28:53 EDT 2007

On Friday 22 June 2007 19:54:16 Philip Armstrong wrote:
> On Fri, Jun 22, 2007 at 10:11:27PM +0400, Bulat Ziganshin wrote:
> >btw, *their* measurement said that ocaml is 7% faster :)
> Indeed. The gcc-4.0 compilied binary runs at about 15s IIRC, but it's
> still much better than 7% faster than the ocaml binary.

What architecture, platform, compiler versions and compile lines are you 

On my 2x 2.2GHz Athlon64 running x64 Debian I now get:

GHC 6.6.1:    26.5s    ghc -funbox-strict-fields -O3 ray.hs -o ray
OCaml 3.10.0: 14.158s  ocamlopt -inline 1000 ray.ml -o ray
g++ 4.1.3:     8.056s  g++ -O3 -ffast-math ray.cpp -o ray

Also, the benchmarks and results that I cited before are more up to date than 
the ones you're using. In particular, you might be interested in these faster 


For "./ray 6 512", I get:

OCaml: 3.140s  ocamlopt -inline 1000 ray.ml -o ray
C++:   2.970s  g++ -O3 -ffast-math ray.cpp -o ray

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
The OCaml Journal

More information about the Haskell-Cafe mailing list