From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fetch-pack: speed up loading of refs via commit graph
Date: Thu, 5 Aug 2021 13:53:50 +0200 [thread overview]
Message-ID: <YQvRTpJ0NGakTy9W@ncase> (raw)
In-Reply-To: <YQt/g0iZxAVgw66o@ncase>
[-- Attachment #1: Type: text/plain, Size: 2795 bytes --]
On Thu, Aug 05, 2021 at 08:04:53AM +0200, Patrick Steinhardt wrote:
> On Wed, Aug 04, 2021 at 04:59:40PM -0400, Jeff King wrote:
> > On Wed, Aug 04, 2021 at 03:56:11PM +0200, Patrick Steinhardt wrote:
[snip]
> > I wonder where the remaining 20s is going.
>
> Rebasing this commit on top of my git-rev-list(1) series [1] for the
> connectivity check gives another 25% speedup, going down from 20s to 14s
> (numbers are a bit different given that I'm on a different machine right
> now). From here on, it's multiple things which take time:
>
> - 20% of the time is spent sorting the refs in
> `mark_complete_and_common_ref()`. This time around I feel less
> comfortable to just disable sorting given that it may impact
> correctness.
>
> - 30% of the time is spent looking up object types via
> `oid_object_info_extended()`, where 75% of these lookups come from
> `deref_without_lazy_fetch()`. This can be improved a bit by doing
> the `lookup_unknown_object()` dance, buying a modest speedup of
> ~8%. But this again has memory tradeoffs given that we must
> allocate the object such that all types would fit.
>
> Other than that I don't see any obvious things in the flame graphs. In
> case anybody is interested, I've posted flame graphs in our GitLab issue
> at [2], with the state before this patch, with this patch and in
> combination with [1].
>
> [1]: http://public-inbox.org/git/cover.1627896460.git.ps@pks.im/
> [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/336657#note_642957933
I've put some more time into this. If rebased on top of v4 of [1], then
we can also use `parse_commit_in_graph_gently()` to further speed this
up from 15.8 seconds to 11.6 seconds with below patch. It's the same
memory/speed tradeoff as I'm doing in [1].
I guess I'd still like to treat both series separately for now given
that [1] is more involved compared to this patch series here. I'll then
do a follow-up when (if?) both series have landed.
Patrick
diff --git a/fetch-pack.c b/fetch-pack.c
index 0bf7ed7e47..cc8b2ffa6c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -119,6 +119,17 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid,
{
enum object_type type;
struct object_info info = { .typep = &type };
+ struct object *object = lookup_unknown_object(the_repository, oid);
+
+ if (object->type == OBJ_COMMIT)
+ return (struct commit *) object;
+
+ if (object->type == OBJ_NONE &&
+ parse_commit_in_graph_gently(the_repository, object) == 0) {
+ if (!repo_has_object_file(the_repository, oid))
+ return NULL;
+ return (struct commit *) object;
+ }
while (1) {
if (oid_object_info_extended(the_repository, oid, &info,
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-08-05 11:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-04 13:56 [PATCH] fetch-pack: speed up loading of refs via commit graph Patrick Steinhardt
2021-08-04 14:55 ` Derrick Stolee
2021-08-04 17:45 ` Junio C Hamano
2021-08-04 20:59 ` Jeff King
2021-08-04 21:32 ` Junio C Hamano
2021-08-05 6:04 ` Patrick Steinhardt
2021-08-05 11:53 ` Patrick Steinhardt [this message]
2021-08-05 16:26 ` Junio C Hamano
2021-08-05 20:42 ` Jeff King
2021-08-05 20:40 ` Jeff King
2021-08-05 19:05 ` Ævar Arnfjörð Bjarmason
2021-08-05 20:29 ` Jeff King
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=YQvRTpJ0NGakTy9W@ncase \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).