Skip to content

Commit

Permalink
Micro-optimize pull-one for -> $a, $b { PHASER foo } case
Browse files Browse the repository at this point in the history
Use nqp::isconcrete (which returns 0/1) instead of .DEFINITE (which
returns a full-blown Bool)
  • Loading branch information
lizmat committed Mar 27, 2018
1 parent 9d784dd commit 24ddff7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/Any-iterable-methods.pm6
Expand Up @@ -672,9 +672,11 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?"
method is-lazy() { $!source.is-lazy }

method pull-one() is raw {
$!value-buffer.DEFINITE
?? nqp::setelems($!value-buffer, 0)
!! ($!value-buffer := IterationBuffer.new);
nqp::if(
nqp::isconcrete($!value-buffer),
nqp::setelems($!value-buffer,0),
($!value-buffer := nqp::create(IterationBuffer))
);
my int $redo = 1;
my $result;

Expand Down

0 comments on commit 24ddff7

Please sign in to comment.