Data.List permutations

Daniel Fischer daniel.is.fischer at web.de
Tue Aug 4 14:43:17 EDT 2009


Am Dienstag 04 August 2009 20:30:58 schrieb Slavomir Kaslev:
> On Tue, Aug 4, 2009 at 9:23 PM, Daniel Fischer<daniel.is.fischer at web.de> wrote:

>
> Which version of ghc are you testing on? I guess, it's more recent than
> mine.

6.10.3. But I think if you compiled it with 6.8.*, the library code would still be faster, 
perhaps by a smaller margin.

>
> > Apparently the library code is more amenable to the optimiser (note that
> > the actual library is faster still:
> >
> > Prelude Data.List> length $ permutations [1 .. 10]
> > 3628800
> > (0.49 secs, 551532812 bytes)
> > Prelude Data.List> length $ permutations [1 .. 11]
> > 39916800
> > (3.73 secs, 5953485816 bytes)
> >
> > I have no idea why).
>
> Probably because it's compiled (and not interpreted) in this case.

All my times were from compiled (with -O2) code. The question is, why does the same source 
code produce slower object code in module Perms than in Data.List?
I suppose it's because Data.List was compiled with different command line options, but 
I've no idea which.


More information about the Glasgow-haskell-users mailing list