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

Philip Armstrong phil at kantaka.co.uk
Thu Jun 21 07:36:27 EDT 2007

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.

I have tried the obvious things :)

>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.

cheers, Phil

http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt

More information about the Haskell-Cafe mailing list