[Haskell-cafe] How to improve speed? (MersenneTwister is several times slower than C version)

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Nov 3 05:50:18 EST 2006

Hello Donald,

Thursday, November 2, 2006, 2:21:31 PM, you wrote:

>> 10-20 times difference is typical for GHC programs.

> It's really more like 2-4x. Sometimes better than C.

> Where's this huge figure coming from Bulat? If you have code that
> behaves like this, you should report it.

are you analyzed the cases where performance is close or even better?
i does. it's either because C version is limited by memory performance
or just use different, less efficient algorithm

the cases which shows slowness of ghc-generated code is factorial
algorithm and the program attached. despite that Haskell code is far
uglier, C version outperforms it 20 times. run both programs with
arrays of about 10k elements to see the difference:

a.out 10000 elements 100000 iterations

in February i've written detailed explanation (in ghc-users) of why this
comes and made some suggestions on improving it. of course, main
problem is ghc's own code generator which is far away from gcc or even
ocaml ones

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: full.c
Type: application/octet-stream
Size: 893 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20061103/e73fad84/full.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newest.hs
Type: application/octet-stream
Size: 1284 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20061103/e73fad84/newest.obj

More information about the Haskell-Cafe mailing list