From: Robin Houston Date: Wed, 22 Aug 2001 23:06:16 +0000 (+0100) Subject: Faster permutation algorithms X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8d2732ab3df9e2b9faffae11f8bca2e14b66c79;p=p5sagit%2Fp5-mst-13.2.git Faster permutation algorithms Message-ID: <20010822230616.A254@robin.kitsite.com> p4raw-id: //depot/perl@11733 --- diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index 08f23f0..ff96afd 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -1291,6 +1291,12 @@ in the permute() function should work on any list: } } +Unfortunately, this algorithm is very inefficient. The Algorithm::Permute +module from CPAN runs at least an order of magnitude faster. If you don't +have a C compiler (or a binary distribution of Algorithm::Permute), then +you can use List::Permutor which is written in pure Perl, and is still +several times faster than the toy algorithm above. + =head2 How do I sort an array by (anything)? Supply a comparison function to sort() (described in L):