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, hask...@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



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to