]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
config: dedupe ibx->{newsgroup}
authorEric Wong <e@80x24.org>
Sun, 19 May 2024 21:55:01 +0000 (21:55 +0000)
committerEric Wong <e@80x24.org>
Mon, 20 May 2024 18:29:39 +0000 (18:29 +0000)
We definitely use newsgroup names as hash keys, so get rid
of the duplicate value for some memory savings when we have
hundreds or thousands of newsgroups.

lib/PublicInbox/Config.pm

index 49659a2e6e7e32a18cc6877830b388e5364c758f..e18439120280abb1454722cf3a3b8e4345442524 100644 (file)
@@ -517,7 +517,9 @@ sub _fill_ibx {
                        delete $ibx->{newsgroup};
                        warn "newsgroup name invalid: `$ngname'\n";
                } else {
-                       my $lc = $ibx->{newsgroup} = lc $ngname;
+                       %dedupe = (lc($ngname) => undef);
+                       my ($lc) = keys %dedupe;
+                       $ibx->{newsgroup} = $lc;
                        warn <<EOM if $lc ne $ngname;
 W: newsgroup=`$ngname' lowercased to `$lc'
 EOM