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

Jon Harrop jon at ffconsultancy.com
Sat Jun 23 05:32:31 EDT 2007

On Saturday 23 June 2007 08:58:10 Philip Armstrong wrote:
> On Sat, Jun 23, 2007 at 03:28:53AM +0100, Jon Harrop wrote:
> >What architecture, platform, compiler versions and compile lines are you
> >using?
> 32-bit x86...

Intel or AMD?

> >  http://www.ffconsultancy.com/languages/ray_tracer/code/5/ray.ml
> >  http://www.ffconsultancy.com/languages/ray_tracer/code/5/ray.cpp
> I gather these use algorithmic optimisations.

Both. Versions 1-4 are progressively algorithmic, version 5 includes low-level 
optimizations (mostly manual inlining and unrolling). Implementing version 1 
is probably also interesting: it is the most concise version.

BTW, the ray tracer leverages the semantics of the float infinity (as the 
parameter when there is no intersection). Shouldn't be a problem but some 
compiler options might break it.

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

More information about the Haskell-Cafe mailing list