From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B3B1B1FA18 for ; Sun, 10 Oct 2021 14:25:19 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/8] extindex: minor cost reductions Date: Sun, 10 Oct 2021 14:25:15 +0000 Message-Id: <20211010142518.7012-6-e@80x24.org> In-Reply-To: <20211010142518.7012-1-e@80x24.org> References: <20211010142518.7012-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Don't bother decoding the 20-byte SHA-1 to a 40-byte hex value since we don't read it, anyways. We can also use the on-stack ibx->eidx_key value instead of dispatching the method again. --- lib/PublicInbox/ExtSearchIdx.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 04948b8b..42488e12 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -902,15 +902,14 @@ DELETE FROM xref3 WHERE ibx_id = ? AND xnum = ? AND oidbin = ? $del->execute; # get_xref3 over-fetches, but this is a rare path: - my $xr3 = $self->{oidx}->get_xref3($docid); + my $xr3 = $self->{oidx}->get_xref3($docid, 1); my $idx = $self->idx_shard($docid); if (scalar(@$xr3) == 0) { # all gone $self->{oidx}->delete_by_num($docid); $self->{oidx}->eidxq_del($docid); $idx->ipc_do('xdb_remove', $docid); } else { # enqueue for reindex of remaining messages - $idx->ipc_do('remove_eidx_info', - $docid, $ibx->eidx_key); + $idx->ipc_do('remove_eidx_info', $docid, $ekey); $self->{oidx}->eidxq_add($docid); # yes, add } }