Skip to content
Permalink
Browse files

ReifiedListIterator can be a PredictiveIterator

Since the list is already reified, we know how many elements there are.
This is a significant speedup for things like `$foo.split(/\s+/).elems`
as it can just return the elements of the list (in fact, the `.elems`
part is now fully inlined into the caller).
  • Loading branch information...
jnthn committed Jun 10, 2019
1 parent cbb9034 commit 9107215a99f106835a121d8446d97d11fc017758
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/core/Rakudo/Iterator.pm6
@@ -2710,7 +2710,7 @@ class Rakudo::Iterator {
# Return an iterator for a List that has been completely reified
# already. Returns an nqp::null for elements that don't exist
# before the end of the reified list.
my class ReifiedListIterator does Iterator {
my class ReifiedListIterator does PredictiveIterator {
has $!reified;
has int $!i;

0 comments on commit 9107215

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