Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make @A eqv @b 10% faster if not equal
By not enforcing an explicit return in that case
  • Loading branch information
lizmat committed May 24, 2015
1 parent bfbf833 commit c56fe3e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/core/Mu.pm
Expand Up @@ -623,15 +623,17 @@ multi sub infix:<eqv>(Any $a, Any $b) {
}

multi sub infix:<eqv>(@a, @b) {
unless @a.WHAT === @b.WHAT && (my int $n = @a.elems) == @b.elems {
return Bool::False
if @a.WHAT === @b.WHAT && (my int $n = @a.elems) == @b.elems {
my int $i;
while $i < $n {
return Bool::False unless @a.AT-POS($i) eqv @b.AT-POS($i);
$i = $i + 1;
}
Bool::True
}
my int $i = 0;
while $i < $n {
return Bool::False unless @a.AT-POS($i) eqv @b.AT-POS($i);
$i = $i + 1;
else {
Bool::False;
}
Bool::True
}

sub DUMP(|args (*@args, :$indent-step = 4, :%ctx?)) {
Expand Down

0 comments on commit c56fe3e

Please sign in to comment.