From 6449835281b15046c71e5cdad7e1a5c422de2fad Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 25 Jul 2021 00:43:29 +0000 Subject: extsearchidx: favor binary comparison in common case We'll use 20-byte SHA-1 comparisons instead of 40-byte hex representations for a minor reduction in memory traffic. --- lib/PublicInbox/ExtSearchIdx.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/ExtSearchIdx.pm') diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 51dbf54f..fb1f511e 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -784,16 +784,16 @@ ORDER BY docid,xnum ASC LIMIT 10000 $fetching = $min = $docid; my $smsg = $ibx->over->get_art($xnum); - my $oidhex = unpack('H*', $oidbin); my $err; if (!$smsg) { $err = 'stale'; - } elsif ($smsg->{blob} ne $oidhex) { + } elsif (pack('H*', $smsg->{blob}) ne $oidbin) { $err = "mismatch (!= $smsg->{blob})"; } else { next; # likely, all good } # current_info already has eidx_key + my $oidhex = unpack('H*', $oidbin); warn "$xnum:$oidhex (#$docid): $err\n"; my $del = $self->{oidx}->dbh->prepare_cached(<<''); DELETE FROM xref3 WHERE ibx_id = ? AND xnum = ? AND oidbin = ? -- cgit v1.2.3-24-ge0c7