[Haskell-cafe] Progress on shootout entries

Cale Gibbard cgibbard at gmail.com
Tue Jan 3 18:29:58 EST 2006

On 03/01/06, Cale Gibbard <cgibbard at gmail.com> wrote:
> I managed to do better with the following program which gets the
> following time report on my machine
> real    0m8.175s
> user    0m7.742s
> sys     0m0.186s
> as opposed to
> real    0m23.232s
> user    0m21.115s
> sys     0m0.077s
> for the shootout code.
> I didn't try too hard to optimise it heavily, but it does use a
> tree-based permutation generator I stole from some code which was in
> an n-queens solution I had laying around (pretty sure it's not mine),
> and an obvious memoisation hack when handling the flips.
Hmm, do the permutations have to be in their specific order? This
permutation generator seems to go through them in a somewhat different
order. It seems irrelevant to the problem, but since they want the
permutations as part of the output, it's a good question. :) In that
case, I wonder if it would be best to use some other generator to
print the first 30, then switch to some faster generator for the
actual computation. :)

 - Cale

More information about the Haskell-Cafe mailing list