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

peterv bf3 at telenet.be
Thu Jun 21 14:15:36 EDT 2007

So float math in *slower* than double math in Haskell? That is interesting.
Why is that?	

BTW, does Haskell support 80-bit "long double"s? The Intel CPU seems to use
that format internally.

-----Original Message-----
From: haskell-cafe-bounces at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Philip Armstrong
Sent: Thursday, June 21, 2007 1:36 PM
To: Haskell-Cafe at haskell.org; Sebastian Sylvan
Subject: Re: [Haskell-cafe] Haskell version of ray tracer code is much
slower than the original ML

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
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org

More information about the Haskell-Cafe mailing list