On Fri, Jan 18, 2002 at 08:39:09PM +0100, Steffen Müller wrote: > you could replace the permute function with the one below. It's a > few times faster, I think. MJD wrote it, I just modified it.
Last time I did permutation benchmarks, MJD's routine came out even slower than the one in perlfaq4 whenever the list was longer than 8 elements. If you want to generate permutations *really* fast, grab Algorithm::FastPermute from the CPAN. The fastest _pure Perl_ permutation routine I've seen is the one at http://use.perl.org/journal.pl?op=display&uid=1821&id=699 Can anyone beat it? For the purposes of this contest, the routine simply has to print the permutations to stdout. .robin.