Permalink
Browse files

Make Blob:D eq/ne Blob:D about 250x faster

- for two 10K identical buffers, faster still for inequal buffers
- no longer allocates copies of both buffers, so more memory friendly
  • Loading branch information...
lizmat committed Feb 26, 2016
1 parent fe14385 commit 1969a42525f69d930735009a1dbbc39f3e910888
Showing with 2 additions and 7 deletions.
  1. +2 −7 src/core/Buf.pm
@@ -654,13 +654,8 @@ multi sub infix:<cmp>(Blob:D $a, Blob:D $b) {
[||] $a.list Z<=> $b.list or $a.elems <=> $b.elems
}

multi sub infix:<eq>(Blob:D $a, Blob:D $b) {
$a.elems == $b.elems && $a.list eq $b.list
}

multi sub infix:<ne>(Blob:D $a, Blob:D $b) {
not $a eq $b;
}
multi sub infix:<eq>(Blob:D \a, Blob:D \b) { a.SAME(b) }
multi sub infix:<ne>(Blob:D \a, Blob:D \b) { !a.SAME(b) }

multi sub infix:<lt>(Blob:D $a, Blob:D $b) {
($a cmp $b) == -1

0 comments on commit 1969a42

Please sign in to comment.