[Haskell-cafe] Performance question

haskell at kudling.de haskell at kudling.de
Thu Feb 26 04:53:28 EST 2009


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

                                                               individual    inherited
COST CENTRE              MODULE                                               no.    entries  %time %alloc   %time %alloc

MAIN                     MAIN                                                   1           0   0.0    0.0   100.0  100.0
 main                    Main                                                 254           1  88.1   90.8   100.0  100.0
  monteCarloPi           Main                                                 255           1   0.6    1.1    11.9    9.2
   pairs                 Main                                                 257    10000000   0.7    1.4     0.7    1.4
   countHits             Main                                                 256    10000001   4.2    2.9    10.6    6.7
    accumulateHit        Main                                                 258    27852236   3.0    2.3     6.4    3.8
     isInCircle          Main                                                 259    30000000   3.3    1.5     3.3    1.5
 CAF:lit_r1A7            Main                                                 248           1   0.0    0.0     0.0    0.0
  isInCircle             Main                                                 260           0   0.0    0.0     0.0    0.0


More information about the Haskell-Cafe mailing list