From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/4] git: reduce early bare-bones memory use
Date: Mon, 26 Sep 2022 10:17:15 +0000 [thread overview]
Message-ID: <20220926101715.1853-5-e@80x24.org> (raw)
In-Reply-To: <20220926101715.1853-1-e@80x24.org>
The {-git_path} cache can rely on auto-vivification, and
{alt_st} may not be needed for short-lived repos. So don't
populate those fields until they're needed, since we can
expect to handle thousands of git repos, too.
---
lib/PublicInbox/Git.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index b2ae75c8..9140caea 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -66,7 +66,7 @@ sub new {
$git_dir =~ tr!/!/!s;
$git_dir =~ s!/*\z!!s;
# may contain {-tmp} field for File::Temp::Dir
- bless { git_dir => $git_dir, alt_st => '', -git_path => {} }, $class
+ bless { git_dir => $git_dir }, $class
}
sub git_path ($$) {
@@ -90,7 +90,7 @@ sub alternates_changed {
# can't rely on 'q' on some 32-bit builds, but `d' works
my $st = pack('dd', $st[10], $st[7]); # 10: ctime, 7: size
- return 0 if $self->{alt_st} eq $st;
+ return 0 if ($self->{alt_st} // '') eq $st;
$self->{alt_st} = $st; # always a true value
}
prev parent reply other threads:[~2022-09-26 10:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-26 10:17 [PATCH 0/4] some minor performance tweaks Eric Wong
2022-09-26 10:17 ` [PATCH 1/4] viewdiff: save memory by eliminating two captures Eric Wong
2022-09-26 10:17 ` [PATCH 2/4] gcf2: support worktree $GIT_DIR Eric Wong
2022-09-26 10:17 ` [PATCH 3/4] viewvcs: load blobs asynchronously Eric Wong
2022-09-26 10:17 ` Eric Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220926101715.1853-5-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).