Skip to content

Commit

Permalink
Make permutations() almost 20% faster
Browse files Browse the repository at this point in the history
Thanks to using compile-time $?BITS instead of $*KERNEL.bits
  • Loading branch information
lizmat committed Jan 14, 2017
1 parent 505766f commit 78edbbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/List.pm
Expand Up @@ -8,7 +8,7 @@ sub combinations(Int() $n, Int() $k) {

sub permutations(Int() $n) {
return ((),).Seq if $n < 1;
my $max = $*KERNEL.bits == 32 ?? 13 !! 20;
my constant $max = $?BITS == 32 ?? 13 !! 20;
die "Cowardly refusing to permutate more than $max elements, tried $n"
if $n > $max;

Expand Down

0 comments on commit 78edbbb

Please sign in to comment.