From a2d8c96b83b84b2ce4ac3948be5d8af08e6de40a Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Mon, 9 Apr 2018 10:44:43 +0200 Subject: [PATCH] Micro-optimize native array iterator By not using a private method --- src/core/native_array.pm6 | 18 +++++++++--------- tools/build/makeNATIVE_ARRAY.pl6 | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/native_array.pm6 b/src/core/native_array.pm6 index 2dbcae52f97..226c7ce70b9 100644 --- a/src/core/native_array.pm6 +++ b/src/core/native_array.pm6 @@ -57,7 +57,7 @@ my class array does Iterable { my role strarray[::T] does Positional[T] is array_type(T) { #- start of generated part of strarray role ----------------------------------- -#- Generated on 2018-04-09T09:53:10+02:00 by tools/build/makeNATIVE_ARRAY.pl6 +#- Generated on 2018-04-09T10:32:44+02:00 by tools/build/makeNATIVE_ARRAY.pl6 #- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE multi method AT-POS(strarray:D: int $idx) is raw { @@ -295,12 +295,12 @@ my class array does Iterable { has int $!i; has $!array; # Native array we're iterating - method !SET-SELF(\array) { + method SET-SELF(\array) { $!array := nqp::decont(array); $!i = -1; self } - method new(\array) { nqp::create(self)!SET-SELF(array) } + method new(\array) { nqp::create(self).SET-SELF(array) } method pull-one() is raw { ($!i = $!i + 1) < nqp::elems($!array) @@ -428,7 +428,7 @@ my class array does Iterable { my role intarray[::T] does Positional[T] is array_type(T) { #- start of generated part of intarray role ----------------------------------- -#- Generated on 2018-04-09T09:53:10+02:00 by tools/build/makeNATIVE_ARRAY.pl6 +#- Generated on 2018-04-09T10:32:44+02:00 by tools/build/makeNATIVE_ARRAY.pl6 #- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE multi method AT-POS(intarray:D: int $idx) is raw { @@ -666,12 +666,12 @@ my class array does Iterable { has int $!i; has $!array; # Native array we're iterating - method !SET-SELF(\array) { + method SET-SELF(\array) { $!array := nqp::decont(array); $!i = -1; self } - method new(\array) { nqp::create(self)!SET-SELF(array) } + method new(\array) { nqp::create(self).SET-SELF(array) } method pull-one() is raw { ($!i = $!i + 1) < nqp::elems($!array) @@ -824,7 +824,7 @@ my class array does Iterable { my role numarray[::T] does Positional[T] is array_type(T) { #- start of generated part of numarray role ----------------------------------- -#- Generated on 2018-04-09T09:53:10+02:00 by tools/build/makeNATIVE_ARRAY.pl6 +#- Generated on 2018-04-09T10:32:44+02:00 by tools/build/makeNATIVE_ARRAY.pl6 #- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE multi method AT-POS(numarray:D: int $idx) is raw { @@ -1062,12 +1062,12 @@ my class array does Iterable { has int $!i; has $!array; # Native array we're iterating - method !SET-SELF(\array) { + method SET-SELF(\array) { $!array := nqp::decont(array); $!i = -1; self } - method new(\array) { nqp::create(self)!SET-SELF(array) } + method new(\array) { nqp::create(self).SET-SELF(array) } method pull-one() is raw { ($!i = $!i + 1) < nqp::elems($!array) diff --git a/tools/build/makeNATIVE_ARRAY.pl6 b/tools/build/makeNATIVE_ARRAY.pl6 index 9ef45ae1e83..d22671d1613 100644 --- a/tools/build/makeNATIVE_ARRAY.pl6 +++ b/tools/build/makeNATIVE_ARRAY.pl6 @@ -282,12 +282,12 @@ for $*IN.lines -> $line { has int $!i; has $!array; # Native array we're iterating - method !SET-SELF(\array) { + method SET-SELF(\array) { $!array := nqp::decont(array); $!i = -1; self } - method new(\array) { nqp::create(self)!SET-SELF(array) } + method new(\array) { nqp::create(self).SET-SELF(array) } method pull-one() is raw { ($!i = $!i + 1) < nqp::elems($!array)