about summary refs log tree commit homepage
path: root/lib/PublicInbox/Config.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-04 22:03:48 +0000
committerEric Wong <e@80x24.org>2020-12-05 21:41:52 +0000
commit629e22b8351e96a831535baa2854d0c9ca014445 (patch)
treec0739fd29537cfec066daa3938a8dfbe688e7bff /lib/PublicInbox/Config.pm
parent6ef28d7e22a499b8a9d531d1c16acd4847496e8e (diff)
downloadpublic-inbox-629e22b8351e96a831535baa2854d0c9ca014445.tar.gz
newswww: use ->ALL to avoid O(n) inbox scan
We can avoid doing a Message-ID lookup on every single inbox
by using ->ALL to scan its over.sqlite3 DB.  This mimics NNTP
behavior and picks the first message indexed, though redirecting
to /all/$MESSAGE_ID/ could be done.

With the current lore.kernel.org set of inboxes (~140), this
provides a 10-40% speedup depending on inbox ordering.
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r--lib/PublicInbox/Config.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 9b9d5c19..ba0ead6e 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -33,6 +33,7 @@ sub new {
         $self->{-by_list_id} = {};
         $self->{-by_name} = {};
         $self->{-by_newsgroup} = {};
+        $self->{-by_eidx_key} = {};
         $self->{-no_obfuscate} = {};
         $self->{-limiters} = {};
         $self->{-code_repos} = {}; # nick => PublicInbox::Git object
@@ -476,8 +477,7 @@ EOF
                         push @$repo_objs, $repo if $repo;
                 }
         }
-
-        $ibx
+        $self->{-by_eidx_key}->{$ibx->eidx_key} = $ibx;
 }
 
 sub _fill_ei ($$) {