user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/4] extsearchidx: favor binary comparison in common case
  2021-07-25  0:43  5% [PATCH 0/4] favor shorter binary OID comparisons Eric Wong
@ 2021-07-25  0:43  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-07-25  0:43 UTC (permalink / raw)
  To: meta

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(-)

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 = ?

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] favor shorter binary OID comparisons
@ 2021-07-25  0:43  5% Eric Wong
  2021-07-25  0:43  7% ` [PATCH 1/4] extsearchidx: favor binary comparison in common case Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-07-25  0:43 UTC (permalink / raw)
  To: meta

We were doing unneccessary 40-byte hex comparisons for SHA-1s
in our code when 20-byte comparisons would've been sufficient.
3/4 is a typo fix which didn't hit any warnings before,
either...

Eric Wong (4):
  extsearchidx: favor binary comparison in common case
  lei_search: favor binary OID comparisons
  lei_inspect: fix typo
  lei_mail_sync: locations_for API uses oidbin for comparisons

 lib/PublicInbox/ExtSearchIdx.pm | 4 ++--
 lib/PublicInbox/LeiExportKw.pm  | 7 +++----
 lib/PublicInbox/LeiInspect.pm   | 7 ++++---
 lib/PublicInbox/LeiMailSync.pm  | 7 ++++---
 lib/PublicInbox/LeiSearch.pm    | 6 +++---
 t/lei_mail_sync.t               | 4 ++--
 6 files changed, 18 insertions(+), 17 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-07-25  0:43  5% [PATCH 0/4] favor shorter binary OID comparisons Eric Wong
2021-07-25  0:43  7% ` [PATCH 1/4] extsearchidx: favor binary comparison in common case Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).