* [PATCH 4/4] git: reduce early bare-bones memory use
2022-09-26 10:17 5% [PATCH 0/4] some minor performance tweaks Eric Wong
@ 2022-09-26 10:17 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-09-26 10:17 UTC (permalink / raw)
To: meta
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
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] some minor performance tweaks
@ 2022-09-26 10:17 5% Eric Wong
2022-09-26 10:17 7% ` [PATCH 4/4] git: reduce early bare-bones memory use Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-09-26 10:17 UTC (permalink / raw)
To: meta
There's some weird stuff cooking up that's not ready, yet...
Here's a few minor tweaks which should provide benefits today,
though.
1/4 should be the last major-ish memory reduction in WWW for a
while. 2/4 is needed for 3/4 with libgit2, and 4/4 may prove
more useful in the future...
Eric Wong (4):
viewdiff: save memory by eliminating two captures
gcf2: support worktree $GIT_DIR
viewvcs: load blobs asynchronously
git: reduce early bare-bones memory use
lib/PublicInbox/Gcf2.pm | 7 ++++---
lib/PublicInbox/Git.pm | 4 ++--
lib/PublicInbox/ViewDiff.pm | 18 +++++++++---------
lib/PublicInbox/ViewVCS.pm | 21 ++++++++++++++++-----
4 files changed, 31 insertions(+), 19 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 --
2022-09-26 10:17 5% [PATCH 0/4] some minor performance tweaks Eric Wong
2022-09-26 10:17 7% ` [PATCH 4/4] git: reduce early bare-bones memory 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).