From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Rasmus Villemoes" <rv@rasmusvillemoes.dk>,
"Git Mailing List" <git@vger.kernel.org>,
"Stefan Beller" <stefanbeller@gmail.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH] packfile: actually set approximate_object_count_valid
Date: Thu, 17 Sep 2020 11:26:21 -0700 [thread overview]
Message-ID: <xmqqy2l8qmya.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200917164743.GA3731633@coredump.intra.peff.net> (Jeff King's message of "Thu, 17 Sep 2020 12:47:43 -0400")
Jeff King <peff@peff.net> writes:
> Subject: [PATCH] packfile: actually set approximate_object_count_valid
>
> The approximate_object_count() function tries to compute the count only
> once per process. But ever since it was introduced in 8e3f52d778
> (find_unique_abbrev: move logic out of get_short_sha1(), 2016-10-03), we
> failed to actually set the "valid" flag, meaning we'd compute it fresh
> on every call.
> ...
> Test origin HEAD
> ----------------------------------------------------------------------------
> 5303.3: rev-list (1) 28.91(28.46+0.44) 29.03(28.65+0.38) +0.4%
> 5303.4: abbrev-commit (1) 1.18(1.06+0.11) 1.17(1.02+0.14) -0.8%
> 5303.7: rev-list (50) 28.95(28.56+0.38) 29.50(29.17+0.32) +1.9%
> 5303.8: abbrev-commit (50) 3.67(3.56+0.10) 3.57(3.42+0.15) -2.7%
> 5303.11: rev-list (1000) 30.34(29.89+0.43) 30.82(30.35+0.46) +1.6%
> 5303.12: abbrev-commit (1000) 86.82(86.52+0.29) 77.82(77.59+0.22) -10.4%
Yuk, this is quite extreme.
> 5303.15: load 10,000 packs 0.08(0.02+0.05) 0.08(0.02+0.06) +0.0%
>
> It doesn't help at all when we have 1 pack (5303.4), but we get a 10%
> speedup when there are 1000 packs (5303.12). That's a modest speedup for
> a case that's already slow and we'd hope to avoid in general (note how
> slow it is even after, because we have to look in each of those packs
> for abbreviations). But it's a one-line change that clearly matches the
> original intent, so it seems worth doing.
>
> The included perf test may also be useful for keeping an eye on any
> regressions in the overall abbreviation code.
>
> Reported-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> packfile.c | 1 +
> t/perf/p5303-many-packs.sh | 4 ++++
> 2 files changed, 5 insertions(+)
Thanks for finding and fixing. I agree that this is worth doing.
prev parent reply other threads:[~2020-09-17 18:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 8:20 approximate_object_count_valid never set? Rasmus Villemoes
2020-09-17 11:58 ` Ævar Arnfjörð Bjarmason
2020-09-17 12:53 ` Jeff King
2020-09-17 16:47 ` [PATCH] packfile: actually set approximate_object_count_valid Jeff King
2020-09-17 16:53 ` Taylor Blau
2020-09-17 18:26 ` Junio C Hamano [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: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqy2l8qmya.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=rv@rasmusvillemoes.dk \
--cc=stefanbeller@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.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).