From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8ED8C1F489 for ; Tue, 25 Apr 2023 11:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1682420579; bh=dq8ueFvZmWd0GyAxuj7w3MpF8vDV5u+RBDMirJIXSlA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oDlnwShyhWq3XnjpqcANkQlM+oAAc3RtcMwYxlgeShpOM449DDuX1vTNrw4K22Hsb fNyfVvox1ZvVy69CoiyDb5xeycXr4ddWD8Pn9qhUpBziKofnb1byOhHicnTxzVZH2S NU7WalVa/XANSdTWnN0swG7eQAoN+R19cMbyC1yU= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/6] searchidx: reduce short-lived variables for TermGenerator Date: Tue, 25 Apr 2023 11:02:57 +0000 Message-Id: <20230425110258.2538658-6-e@80x24.org> In-Reply-To: <20230425110258.2538658-1-e@80x24.org> References: <20230425110258.2538658-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We can avoid needless refcount traffic in some cases. --- lib/PublicInbox/SearchIdx.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 3415cce4..cfc2d544 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -178,9 +178,8 @@ sub term_generator ($) { # write-only sub index_phrase ($$$$) { my ($self, $text, $wdf_inc, $prefix) = @_; - my $tg = term_generator($self); - $tg->index_text($text, $wdf_inc, $prefix); - $tg->increase_termpos; + term_generator($self)->index_text($text, $wdf_inc, $prefix); + $self->{term_generator}->increase_termpos; } sub index_text ($$$$) { @@ -189,8 +188,8 @@ sub index_text ($$$$) { if ($self->{indexlevel} eq 'full') { index_phrase($self, $text, $wdf_inc, $prefix); } else { - my $tg = term_generator($self); - $tg->index_text_without_positions($text, $wdf_inc, $prefix); + term_generator($self)->index_text_without_positions( + $text, $wdf_inc, $prefix); } } @@ -457,8 +456,7 @@ sub eml2doc ($$$;$) { add_val($doc, PublicInbox::Search::UID(), $smsg->{num}); add_val($doc, PublicInbox::Search::THREADID, $smsg->{tid}); - my $tg = term_generator($self); - $tg->set_document($doc); + term_generator($self)->set_document($doc); index_headers($self, $smsg); if (defined(my $eidx_key = $smsg->{eidx_key})) {