[Haskell-cafe] Re: newbie optimization question
Peter Hercek
peter at syncad.com
Sun Oct 28 17:38:09 EDT 2007
Daniel Fischer wrote:
> What perpetually puzzles me is that in C long long int has very good
> performance, *much* faster than gmp, in Haskell, on my computer, Int64 is
> hardly faster than Integer.
I tried the example with Int64 and Integer. The integer version
was actually quicker ... which is the reason I decided to post
the results.
C++ version times: 1.125; 1.109; 1.125
Int32 cpu times: 3.203; 3.172; 3.172
Int64 cpu times: 11.734; 11.797; 11.844
Integer cpu times: 9.609; 9.609; 9.500
Interesting that Int64 is *slower* than Integer.
On the other side the C version is not that much quicker. I guess
the Haskell version is using generic versions of mod and sum
(since they are from a library) which would mean indirect calls.
The Haskell version probably also creates the list nodes ...
even when they get almost immediately garbage collected.
Thanks for pointing out Int64 sucks so much :)
Peter.
More information about the Haskell-Cafe
mailing list