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 56EC11F51B for ; Mon, 11 Mar 2024 19:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1710186013; bh=YkcOBmNu/OpQOsgOWa2wDqCvabKg6r4j3Y17GPFtyeM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=zc/WeJHaSTZ27B6HW/vhlCmTndgn7KLLyYv9aRNjuSTvZ8MRwzmNKJRo5CDQgCYLs j9daVXlP5xhU7nKUtJOoPn/uLuN5Yep3Gvh8BVL+ItxxMl2riZKsLDnUo8YSmUG4Th cjg+WDp2x/xydov6uTDofIFSFPpU7d2iD0CQA+5c= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] codesearch: deduplicate $git->{nick} field Date: Mon, 11 Mar 2024 19:40:12 +0000 Message-ID: <20240311194012.1266143-5-e@80x24.org> In-Reply-To: <20240311194012.1266143-1-e@80x24.org> References: <20240311194012.1266143-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: While PublicInbox::Config is responsible for some instances of setting $git->{nick}, more PublicInbox::Git objects may be created from loading the cindex and we should do our best to reuse that memory, too. Followup-to: 84ed7ec1c887 (dedupe inbox names, coderepo nicks + git dirs, 2024-03-04) --- lib/PublicInbox/CodeSearch.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/CodeSearch.pm b/lib/PublicInbox/CodeSearch.pm index 48033bb5..e5fa4480 100644 --- a/lib/PublicInbox/CodeSearch.pm +++ b/lib/PublicInbox/CodeSearch.pm @@ -283,7 +283,8 @@ EOM $nick =~ s!$lre!$nick_pfx!s or next; $dir2cr{$p} = $coderepos->{$nick} //= do { my $git = PublicInbox::Git->new($p); - $git->{nick} = $nick; # for git->pub_urls + my %dedupe = ($nick => undef); + ($git->{nick}) = keys %dedupe; # for git->pub_urls $git; }; }