[Haskell-cafe] Performance question

Ben Lippmeier Ben.Lippmeier at anu.edu.au
Thu Feb 26 05:09:57 EST 2009


Yep, this program will crawl.

You can get reasonable numeric performance out of GHC, but you need to  
work at it. There is some advice in the GHC manual at http://www.haskell.org/ghc/docs/latest/html/users_guide/faster.html 
.

The first thing I would do is replace your
isInCircle :: (Floating a, Ord a)  => (a,a) -> Bool
with
isInCircle :: (Double, Double) -> Bool

Ben.



On 26/02/2009, at 8:53 PM, haskell at kudling.de wrote:

> Hi,
>
> i have compared a C++ implementation with a Haskell implementation  
> of the Monte Carlo Pi approximation:
>
> http://lennart.kudling.de/haskellPi/
>
> The Haskell version is 100 times slower and i wonder whether i do  
> something obvious wrong.
>
> Profiling says that the majority of the time is spend in "main". But  
> i have no idea where.
>
> Can someone give me a hint?
>
> Thanks,
> Lenny
>
>



More information about the Haskell-Cafe mailing list