* [PATCH 14/15] inbox: shrink data structures for publicinbox.*.hide
2023-11-30 11:40 5% [PATCH 00/15] various cindex fixes + speedups Eric Wong
@ 2023-11-30 11:41 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-11-30 11:41 UTC (permalink / raw)
To: meta
We no longer vivify the intermediate $ibx->{-hide} hashref,
instead we use $ibx->{-hide_$KEY} directly. This avoids
an intermediate hashref and extra hash table lookups.
---
lib/PublicInbox/CodeSearch.pm | 2 +-
lib/PublicInbox/Inbox.pm | 8 ++------
lib/PublicInbox/WwwListing.pm | 2 +-
3 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/PublicInbox/CodeSearch.pm b/lib/PublicInbox/CodeSearch.pm
index 208f7528..f4694686 100644
--- a/lib/PublicInbox/CodeSearch.pm
+++ b/lib/PublicInbox/CodeSearch.pm
@@ -328,7 +328,7 @@ EOM
if (my $git = $dir2cr{$_}) {
$ibx_p2g{$_} = $git;
$ibx2self = 1;
- $ibx->{-hide}->{www} or
+ $ibx->{-hide_www} or
push @{$git->{ibx_score}},
[ $nr, $ibx->{name} ];
push @$gits, $git;
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 7af0ad90..dd689221 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -70,12 +70,8 @@ sub new {
delete $opts->{feedmax};
}
# allow any combination of multi-line or comma-delimited hide entries
- my $hide = {};
- if (defined(my $h = $opts->{hide})) {
- foreach my $v (@$h) {
- $hide->{$_} = 1 foreach (split(/\s*,\s*/, $v));
- }
- $opts->{-hide} = $hide;
+ for $v (@{delete($opts->{hide}) // []}) {
+ $opts->{-'hide_'.$_} = 1 for split(/\s*,\s*/, $v);
}
bless $opts, $class;
}
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index e3d2e84c..2d6c74da 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -79,7 +79,7 @@ sub hide_key { 'www' }
sub hide_inbox {
my ($ctx, $ibx, $re) = @_;
- $ibx->{-hide}->{$ctx->hide_key} ||
+ $ibx->{'-hide_'.$ctx->hide_key} ||
!grep(/$re/, @{$ibx->{url} // $ctx->{-name_is_url} // []})
}
^ permalink raw reply related [relevance 7%]
* [PATCH 00/15] various cindex fixes + speedups
@ 2023-11-30 11:40 5% Eric Wong
2023-11-30 11:41 7% ` [PATCH 14/15] inbox: shrink data structures for publicinbox.*.hide Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-11-30 11:40 UTC (permalink / raw)
To: meta
Notable changes:
10/15 provides a huge speedup which will hopefully make
future developments faster.
12/15 probably obsoletes libgit2 for extindex "all" users.
13/15 can save some memory with many inboxes while making
configuration easier.
Eric Wong (15):
cindex: fix store_repo+repo_stored on no-op
codesearch: allow inbox count to exceed matches
config: reject newlines consistently in dir names
cindex: only create {-cidx_err} field on failures
cindex: keep batch pipe for pruning SHA-256 repos
cindex: store extensions.objectFormat with repo data
git: share unlinked pack checking code with gcf2
cindex: skip getpid guard for most OnDestroy use
spawn: drop IO layer support from redirects
cindex: speed up initial scan setup phase
inbox: expire resources more aggressively
git_async_cat: use git from "all" extindex if possible
www_listing: support publicInbox.nameIsUrl
inbox: shrink data structures for publicinbox.*.hide
codesearch: use retry_reopen for WWW
Documentation/public-inbox-config.pod | 19 +-
lib/PublicInbox/CodeSearch.pm | 54 +++--
lib/PublicInbox/CodeSearchIdx.pm | 286 ++++++++++++++++----------
lib/PublicInbox/Config.pm | 32 ++-
lib/PublicInbox/Gcf2.pm | 16 +-
lib/PublicInbox/Git.pm | 27 +--
lib/PublicInbox/GitAsyncCat.pm | 8 +-
lib/PublicInbox/Inbox.pm | 32 +--
lib/PublicInbox/MailDiff.pm | 3 +-
lib/PublicInbox/SearchIdx.pm | 5 +-
lib/PublicInbox/Spawn.pm | 32 +--
lib/PublicInbox/WwwListing.pm | 21 +-
12 files changed, 303 insertions(+), 232 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-11-30 11:40 5% [PATCH 00/15] various cindex fixes + speedups Eric Wong
2023-11-30 11:41 7% ` [PATCH 14/15] inbox: shrink data structures for publicinbox.*.hide Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).