* [PATCH 08/15] cindex: skip getpid guard for most OnDestroy use
2023-11-30 11:40 7% [PATCH 00/15] various cindex fixes + speedups Eric Wong
@ 2023-11-30 11:41 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-11-30 11:41 UTC (permalink / raw)
To: meta
We no longer fork after cidx_init, so there's no need to spend
CPU cycles on the getpid() syscall, especially since it's no
longer cached on glibc while syscalls are also more expensive
these days due to CPU vulnerability mitigations.
---
lib/PublicInbox/CodeSearchIdx.pm | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 7580a49a..555a1efe 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -365,7 +365,7 @@ sub repo_stored {
$did > 0 or die "BUG: $repo_ctx->{repo}->{git_dir}: docid=$did";
my ($c, $p) = PublicInbox::PktOp->pair;
$c->{ops}->{shard_done} = [ $self, $repo_ctx,
- PublicInbox::OnDestroy->new($$, \&next_repos, $repo_ctx, $drs)];
+ PublicInbox::OnDestroy->new(\&next_repos, $repo_ctx, $drs)];
# shard_done fires when all shards are committed
my @active = keys %{$repo_ctx->{active}};
$IDX_SHARDS[$_]->wq_io_do('shard_commit', [ $p->{op_p} ]) for @active;
@@ -607,8 +607,8 @@ sub index_next ($) {
index_repo(undef, $self, shift @$IDXQ);
} elsif ($SCANQ && @$SCANQ) {
my $git = shift @$SCANQ;
- my $prep_repo = PublicInbox::OnDestroy->new($$, \&prep_repo,
- $self, $git);
+ my $prep_repo = PublicInbox::OnDestroy->new(\&prep_repo,
+ $self, $git);
fp_start($self, $git, $prep_repo);
ct_start($self, $git, $prep_repo);
} elsif ($TMPDIR) {
@@ -669,7 +669,7 @@ sub index_repo { # run_git cb
my $repo_ctx = $REPO_CTX = { self => $self, repo => $repo };
delete $git->{-cidx_gits_fini}; # may fire gits_fini
my $drs = delete $git->{-cidx_dump_roots_start};
- my $index_done = PublicInbox::OnDestroy->new($$, \&index_done,
+ my $index_done = PublicInbox::OnDestroy->new(\&index_done,
$repo_ctx, $drs);
my ($c, $p) = PublicInbox::PktOp->pair;
$c->{ops}->{shard_done} = [ $self, $repo_ctx, $index_done ];
@@ -779,7 +779,7 @@ sub scan_git_dirs ($) {
my ($self) = @_;
@$SCANQ = () unless $self->{-opt}->{scan};
$GITS_NR = @$SCANQ or return;
- my $gits_fini = PublicInbox::OnDestroy->new($$, \&gits_fini);
+ my $gits_fini = PublicInbox::OnDestroy->new(\&gits_fini);
$_->{-cidx_gits_fini} = $gits_fini for @$SCANQ;
if (my $drs = $TODO{dump_roots_start}) {
$_->{-cidx_dump_roots_start} = $drs for @$SCANQ;
@@ -851,7 +851,7 @@ sub prep_umask ($) {
umask == $um or progress($self, 'using umask from ',
$self->{cidx_dir}, ': ',
sprintf('0%03o', $um));
- PublicInbox::OnDestroy->new($$, \&CORE::umask, umask($um));
+ PublicInbox::OnDestroy->new(\&CORE::umask, umask($um));
} else {
$self->{umask} = umask; # for SearchIdx->with_umask
undef;
@@ -1073,11 +1073,11 @@ EOM
($JOIN_DT[1]) = ($QRY_STR =~ /\.\.([0-9]{14})\z/); # YYYYmmddHHMMSS
($JOIN_DT[0]) = ($QRY_STR =~ /\Adt:([0-9]{14})/); # YYYYmmddHHMMSS
$JOIN_DT[0] //= '19700101'.'000000'; # git uses unsigned times
- $TODO{do_join} = PublicInbox::OnDestroy->new($$, \&do_join, $self);
+ $TODO{do_join} = PublicInbox::OnDestroy->new(\&do_join, $self);
$TODO{joining} = 1; # keep shards_active() happy
- $TODO{dump_ibx_start} = PublicInbox::OnDestroy->new($$,
- \&dump_ibx_start, $self, $TODO{do_join});
- $TODO{dump_roots_start} = PublicInbox::OnDestroy->new($$,
+ $TODO{dump_ibx_start} = PublicInbox::OnDestroy->new(\&dump_ibx_start,
+ $self, $TODO{do_join});
+ $TODO{dump_roots_start} = PublicInbox::OnDestroy->new(
\&dump_roots_start, $self, $TODO{do_join});
progress($self, "will join in $QRY_STR date range...");
my $id = -1;
@@ -1100,7 +1100,7 @@ sub init_prune ($) {
require_progs('prune', 'xapian-delve' => \@delve, sed => \@sed,
comm => \@COMM, awk => \@AWK);
for (0..$#IDX_SHARDS) { push @delve, "$self->{xpfx}/$_" }
- my $run_prune = PublicInbox::OnDestroy->new($$, \&run_prune, $self,
+ my $run_prune = PublicInbox::OnDestroy->new(\&run_prune, $self,
$TODO{dump_roots_start});
my ($sort_opt, $sed_opt, $delve_opt);
pipe(local $sed_opt->{0}, local $delve_opt->{1});
^ permalink raw reply related [relevance 6%]
* [PATCH 00/15] various cindex fixes + speedups
@ 2023-11-30 11:40 7% Eric Wong
2023-11-30 11:41 6% ` [PATCH 08/15] cindex: skip getpid guard for most OnDestroy use 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 7%]
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 7% [PATCH 00/15] various cindex fixes + speedups Eric Wong
2023-11-30 11:41 6% ` [PATCH 08/15] cindex: skip getpid guard for most OnDestroy use 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).