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

Derek Elkins derek.a.elkins at gmail.com
Thu Jun 21 13:07:24 EDT 2007

On Thu, 2007-06-21 at 13:39 +0100, Jon Harrop wrote:
> Awesome stuff!
> On Thursday 21 June 2007 12:36:27 Philip Armstrong wrote:
> > On Thu, Jun 21, 2007 at 12:25:44PM +0100, Sebastian Sylvan wrote:
> > >Try using floats for the vector, and strict fields (add a ! to the
> > >fields in the data declaration).
> >
> > Because the optimisation page on the haskell wiki is very explicit
> > about never using Float when you can use Double, that's why. An older
> > revision used Float and it was slower than the current one. Making the
> > datatypes strict also makes no difference.
> Where exactly do the !s go and what do they do?

> > >That's the simplest possible thing I can think of after about two
> > >seconds of looking anyway. It appears that the ML version uses float
> > >so I don't understand why you would use Double for the Haskell version
> > >at all, and then think you could do any sort of valid comparisons
> > >between them...
> >
> > OCaML floats are Doubles, at least on x86.
> Yes. OCaml doesn't have a 32-bit float storage format, apart from an 
> entirely-float big array. Also, the ML in OCaml doesn't stand for 
> metalanguage. ;-)

To be technical, it should be OCAML.

More information about the Haskell-Cafe mailing list