Skip to content
Permalink
Browse files

Make for IO::Handle.lines { } about 10% faster

By losing the // and using nqp::ops instead
  • Loading branch information...
lizmat committed Sep 5, 2018
1 parent 3dd09be commit 874ec00225c05a12d30bdedfd0764812185f8e16
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/core/IO/Handle.pm6
@@ -407,8 +407,17 @@ my class IO::Handle {
method pull-one() {
# Slow path falls back to .get on the handle, which will
# replenish the buffer once we exhaust it.
$!decoder.consume-line-chars(:$!chomp)
// ($!handle.get // IterationEnd)
nqp::if(
nqp::isconcrete(
my \consumed := $!decoder.consume-line-chars(:$!chomp)
),
consumed,
nqp::if(
nqp::isconcrete(my \got := $!handle.get),
got,
IterationEnd
)
)
}
method push-all($target --> IterationEnd) {
nqp::while(

0 comments on commit 874ec00

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