Skip to content
Permalink
Browse files

Make my @A = IO::Handle.lines about 10% faster

Lose the // in the loop.
  • Loading branch information...
lizmat committed Sep 5, 2018
1 parent 874ec00 commit d198c1b7323ede082394e8e5b8dfe4a630b1c0c0
Showing with 17 additions and 3 deletions.
  1. +17 −3 src/core/IO/Handle.pm6
@@ -421,9 +421,23 @@ my class IO::Handle {
}
method push-all($target --> IterationEnd) {
nqp::while(
nqp::isconcrete(my \line :=
$!decoder.consume-line-chars(:$!chomp) // $!handle.get),
$target.push(line)
nqp::if(
nqp::isconcrete(
my \consumed := $!decoder.consume-line-chars(:$!chomp)
),
nqp::stmts(
$target.push(consumed),
1
),
nqp::if(
nqp::isconcrete(my \got := $!handle.get),
nqp::stmts(
$target.push(got),
1
)
)
),
nqp::null
)
}
}

0 comments on commit d198c1b

Please sign in to comment.
You can’t perform that action at this time.