Skip to content

Commit

Permalink
Make Blob:D eq/ne Blob:D about 250x faster
Browse files Browse the repository at this point in the history
- 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 1969a42
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/core/Buf.pm
Expand Up @@ -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
Expand Down

0 comments on commit 1969a42

Please sign in to comment.