git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Disable useless check_for_new_submodule_commits() by default

From
Jens Lehmann <jens.lehmann@web.de>
Date
Sep 9, 2011, 16:29 UTC
Message-ID
<4E6A3EE1.9080103@web.de>
In-Reply-To
<7vy5xyv5p3.fsf@alter.siamese.dyndns.org>
Am 09.09.2011 03:56, schrieb Junio C Hamano:
Show 24 quoted lines
> Imagine a project with 20k paths with a history 250k commits deep, without
> any submodule.
> 
> Imagine another project with the same depth of history but with 1k paths,
> among which there are 200 submodules.
> 
> Further, imagine fetching from one of the above repositories into a
> repository that is very behind, and updating many remote tracking
> branches.  Now, think about what check_for_new_submodule_commits() in
> submodule.c that is called from update_local_ref() in builtin/fetch.c
> would do.
> 
> For each updated remote tracking branch (or anything that is not a tag),
> the problem function will run the equivalent of:
> 
> 	git log --raw $new --not --all
> 
> which would mean 250k rounds of diff-tree to enumerate the submodules that
> may have been updated, and it does it for each and every refs outside the
> refs/tags hierarchy.
>
> Presumably, this is so that it only has to actually fetch in the submodule
> "on demand", but even if in a project _with_ submodules (i.e. the latter
> example above), this is simply not acceptable.
Definitely.
> You could just enumerate
> those 200 submodules at the tip that _might_ matter and that would be
> million times cheaper.

But that trick won't do it. I thought about that too when I implemented this feature, but we need to look in all new commits (e.g. a submodule is not present anymore in the new tip but is changed in the preceding but not yet fetched commits, then it still has to be checked if it has the necessary commits locally and they need to be fetched if that is not the case).

> To add insult to injury, this "on demand" behaviour
> is on by default, which hurts projects without any submodules (i.e. the
> former example above) a lot.

Right, I'll post a patch disabling that check completely when a project has no submodules.

Show 8 quoted lines
> In short, if "on demand" check is million times more expensive than
> actually doing it, the check does not have any value.
> 
> In the longer term, people who want to have the on-demand behaviour need
> to come up with a cheaper way to determine if it is necessary to recurse
> into submodules by fixing check_for_new_submodule_commits(), but until
> that happens, we should disable submodule recursion by default unless the
> user explicitly asks for it from the command line or from the configuration.
Ok, I'll see if I can come up with a solution for the performance regression.
Previous: Junio C Hamano
Message 2 of 2 in “Disable useless check_for_new_submodule_commits() by default”
  1. Disable useless check_for_new_submodule_commits() by defaultJunio C Hamano, Sep 9, 2011
  2. Jens LehmannSep 9, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.