Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Optimize Buf.eqv a bit.

  • Loading branch information...
commit 35818f885be581e339cc2bf382bd66dda6f57dd1 1 parent 9ec36bd
Jonathan Worthington jnthn authored

Showing 1 changed file with 14 additions and 2 deletions. Show diff stats Hide diff stats

  1. +14 2 src/core/Buf.pm
16 src/core/Buf.pm
@@ -321,8 +321,20 @@ multi sub infix:<~^>(Blob:D $a, Blob:D $b) {
321 321 }
322 322
323 323 multi infix:<eqv>(Blob:D $a, Blob:D $b) {
324   - $a.WHAT === $b.WHAT && $a.elems == $b.elems &&
325   - [&&] $a.list Z== $b.list
  324 + if $a.WHAT === $b.WHAT && $a.elems == $b.elems {
  325 + my int $n = $a.elems;
  326 + my int $i = 0;
  327 + my Mu $da := nqp::decont($a);
  328 + my Mu $db := nqp::decont($b);
  329 + while $i < $n {
  330 + return False unless nqp::iseq_i(nqp::atpos_i($da, $i), nqp::atpos_i($db, $i));
  331 + $i = $i + 1;
  332 + }
  333 + True
  334 + }
  335 + else {
  336 + False
  337 + }
326 338 }
327 339
328 340 multi sub infix:<cmp>(Blob:D $a, Blob:D $b) {

0 comments on commit 35818f8

Please sign in to comment.
Something went wrong with that request. Please try again.