Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make xx about 3 times faster on literals
  • Loading branch information
TimToady committed Aug 19, 2014
1 parent e7835e9 commit f1a7c65
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/core/List.pm
Expand Up @@ -627,7 +627,25 @@ multi infix:<xx>() { fail "No zero-arg meaning for infix:<xx>" }
multi infix:<xx>(Mu \x) {x }
multi infix:<xx>(Mu \x, $n is copy, :$thunked) {
$n = nqp::p6bool(nqp::istype($n, Whatever)) ?? Inf !! $n.Int;
GatherIter.new({ take ($thunked ?? x.() !! x) while --$n >= 0; }, :infinite($n == Inf)).list
if $thunked {
GatherIter.new({ take x.() while --$n >= 0; }, :infinite($n == Inf)).list
}
else {
GatherIter.new({
SEQ( $n -= 100; take x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
x,x,x,x,x,x,x,x,x,x,
) while $n >= 100;
take x while --$n >= 0;
}, :infinite($n == Inf)).flat
}
}

proto sub pop(@) {*}
Expand Down

0 comments on commit f1a7c65

Please sign in to comment.