Skip to content
Permalink
Browse files

Make List.Array coercion about 1.5x as fast

By mostly removing code and use the new Array.from-list method that
was created for [@A].  This removes the last use of nqp::assign from
the core setting.
  • Loading branch information...
lizmat committed Sep 28, 2018
1 parent 88e6de2 commit 3d405e89d53bd9368ab67fc7dcfffd283fa25070
Showing with 1 addition and 19 deletions.
  1. +1 −19 src/core/List.pm6
@@ -880,25 +880,7 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
nqp::if(
nqp::isconcrete($!todo),
Array.from-iterator(self.iterator),
nqp::if(
nqp::isconcrete($!reified),
nqp::stmts(
(my int $elems = nqp::elems($!reified)),
(my $array := nqp::setelems(nqp::create(IterationBuffer),$elems)),
(my int $i = -1),
nqp::while(
nqp::islt_i(($i = nqp::add_i($i,1)),$elems),
nqp::bindpos($array, $i,
nqp::assign(
nqp::p6scalarfromdesc(nqp::null),
nqp::atpos($!reified,$i)
)
)
),
nqp::p6bindattrinvres(nqp::create(Array),List,'$!reified',$array)
),
nqp::create(Array)
)
Array.from-list(self)
)
}

0 comments on commit 3d405e8

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