Skip to content

Commit

Permalink
Optimize a loop in MATCH
Browse files Browse the repository at this point in the history
- don't box strings
- don't make variables we don't need
  • Loading branch information
lizmat committed Apr 7, 2018
1 parent 17382e6 commit 9b75f67
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/QRegex/Cursor.nqp
Expand Up @@ -1184,11 +1184,9 @@ class NQPMatch is NQPCapture does NQPMatchRole {
$dest := nqp::atkey($hash, $onlyname);
}
while $csi < $cselems {
my $subcur := nqp::atpos($cs, $csi);
my str $name := nqp::getattr_s($subcur, $?CLASS, '$!name');
if !nqp::isnull_s($name) && nqp::defined($name) {
my $submatch := $subcur.MATCH();
nqp::push($dest, $submatch);
my $subcur := nqp::atpos($cs, $csi);
unless nqp::isnull_s(nqp::getattr_s($subcur, $?CLASS, '$!name')) {
nqp::push($dest,$subcur.MATCH());
}
++$csi;
}
Expand Down

0 comments on commit 9b75f67

Please sign in to comment.