On Tue, 2009-12-15 at 10:56 -0800, Thomas DuBuisson wrote: > On Tue, Dec 15, 2009 at 10:30 AM, Maciej Piechotka > <[email protected]> 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? > > Thomas
Ups. I forgot about types :(
Integer
Not optimized & compiled:
First: 19.81 secs, 2774731128 bytes
Second: 22.64 secs, 3092270464 bytes
Optimized & compiled:
First: 0.64 secs, 980673088 bytes
Second: 0.65 secs, 975408024 bytes
Int
Not optimized & compiled:
First: 19.60 secs, 2774208376 bytes
Second: 22.65 secs, 3092274608 bytes
Optimized & compiled:
First: 0.46 secs, 808978336 bytes
Second: 0.43 secs, 803460216 bytes
As for Integer. In case of Int l+1 `seq` something it can be simply
transformed into (pseudo-assembler):
call l
incq %rax ; Or addq $1, %rax
call something
But for Integer:
call l
movq $1, %rbx
call Integer.+
call something
Regards
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
