You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ time nqp -e 'my $l := nqp::list(1,2,3,4,5,6,7,8,9,10); my int $j := 10000000; while $j-- { my $iter := nqp::iterator($l); nqp::while($iter, my $a := nqp::shift($iter)) }'
real 0m1.477s
user 0m1.491s
sys 0m0.009s
versus using a manual indexer:
$ time nqp -e 'my $l := nqp::list(1,2,3,4,5,6,7,8,9,10); my int $j := 10000000; while $j-- { my int $i := -1; nqp::while(nqp::islt_i(($i := nqp::add_i($i,1)),nqp::elems($l)), my $a := nqp::atpos($l,$i)) }'
real 0m0.655s
user 0m0.671s
sys 0m0.008s