[Haskell-cafe] Re: Difference in Runtime but no explanation

Thomas DuBuisson thomas.dubuisson at gmail.com
Tue Dec 15 13:56:41 EST 2009

On Tue, Dec 15, 2009 at 10:30 AM, Maciej Piechotka
<uzytkownik2 at gmail.com> wrote:
> My results (ghc 6.12.1, Core 2 Duo 2.8 GHz, Linux 2.6.32, Gentoo):
> Not Optimized & not compiled:
> First:  12.47 secs, 1530911440 bytes
> Second: 17.40 secs, 1929614816 bytes
> Optimized & compiled:
> First:   1.24 secs, 966280832 bytes
> Second:  1.11 secs, 966277152 bytes

Seconded, I consistently get 0.350 seconds vs 0.300 when compiling the
original code via -O2.

> Repeating gave similar results - first being better w/out
> optimalization as 1.2:1.7 and second being better with optimalizations (-O).
> Why the first one is better unoptimalized?

I think thats not a specific enough question.  I replaced the
'Integer' with 'Int' and found (via -ddump-asm) that the assembly is
_identical_. A test shows what you would expect - the performance was
identical.  So the question in my mind is what presumably trivial
optimization doesn't happen when Integer is used?


More information about the Haskell-Cafe mailing list