
17 Mar
2010
17 Mar
'10
9:24 p.m.
On Mar 17, 2010, at 6:14 PM, Daniel Fischer wrote:
I found it surprisingly not-slow (code compiled with -O2, as usual). There are two points where you waste time.
I found one big point where time is wasted: in computing the powerset of a list. He's making 2^n elements, and then iterating through them all and filtering, but only needs n^2 or n `choose` 2 of the (depending on the semantics for his "groups"). The answer is to do something like: allPairs list = [(x,y) | x <- list, y <- list] to get it done in n^2 time.