develooper Front page | perl.perl5.porters | Postings from August 2001

[PATCH perlfaq4] Faster permutation algorithms

Thread Next
Robin Houston
August 23, 2001 05:32
[PATCH perlfaq4] Faster permutation algorithms
Message ID:
The permutation algorithm given in perlfaq4 is a cute toy, but it's
*very* slow. This patch adds a couple of pointers to CPAN modules which
are faster.


--- perl@11660/pod/perlfaq4.pod.orig	Wed Aug 22 22:32:24 2001
+++ perl@11660/pod/perlfaq4.pod	Wed Aug 22 22:53:47 2001
@@ -1291,6 +1291,12 @@
+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<perlfunc/sort>):

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About