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

Re: [PATCH] git.txt: document limitations on non-typical repos (and hints)

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Oct 7, 2010, 02:25 UTC
Message-ID
<AANLkTinuT9f8B3b=osCkdxtpZR2zJV9WmmTMAAHb8SZD@mail.gmail.com>
In-Reply-To
<7vsk0j46zk.fsf@alter.siamese.dyndns.org>
On Wed, Oct 6, 2010 at 11:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
>> +Performance concerns
>> +--------------------
>> +
>> +Git is written with performance in mind and it works extremely well
>> +with its typical repositories (i.e. source code repositories, with
>> +a moderate number of small text files, possibly with long history).
>> +Non-typical repositories (a lot of files, or very large files...)
>> +may experience mild performance degradation. This section describes
>> +how Git behaves in such repositories and how to reduce impact.
>> +
>
> I have seen this "mild" suggested in the discussion, but do we want any
> adjective here?  The runtime for, say, "git log" from the tip to the root
> obviously would grow proportionally to the length of the history, i.e. the
> number of records you would want to see, and it may not be "mild" if your
> history is very deep.  Same for the runtime for "git diff" in a wide
> project with many changed paths.

I don't want to give an impression that the sky will fall when someone puts a 200MB file in his repo.

> More importantly, what is "degradation"?  It is not a degradation if "git
> log" took 100x as long for a project with 100k commits compared to a
> similar project with 1k commits.

From my perspective, git commands that are instant in typical repos should still be instant in non-typical ones. Yes "git add hugefile" will take longer than "git add git.c", but it should not take, say, 1 hour for that command. It's hard to draw a clear line here.

Show 9 quoted lines
> If you do not have enough core to hold the part of the ancestry graph that
> is involved to compute "git log A..B" to show a gazillion commits, it will
> eat into the swap, take a lot more time than it takes "git log B" to show
> the same number of commits.  That _is_ degradation, and I suspect it won't
> be mild at all.
>
>> +For repositories with a large number of files (~50k files or more),
>
> How did you come up with this 50k number?

Quite unscientific, I started with gentoo-x86 (~130k files) which I know git performs less than satisfactory. I also looked how big other repos are, wine.git, linux-2.6.git... then choose a number in the middle.

Show 6 quoted lines
>> +but you only need a few of them present in working tree, you can use
>> +sparse checkout (see linkgit:git-read-tree[1], section 'Sparse
>> +checkout').
>
> Is "sparse checkout" a real feature that has been made usable by mere
> mortals, battle tested, and shown to be reliable?

Hopefully. In 2010 survey, there are 331 answers they use "partial (sparse) checkout". I hope that they used this feature, not something else.

Show 13 quoted lines
> It feels funny that we have to refer to the documentation of plumbing
> read-tree when the key verb in this paragraph is "checkout".  With the
> current documentation set, you can follow read-tree page that mentions
> some magic called skip-worktree-bit, get tempted to jump to update-index
> page and get lost in the implementation details of the feature, which is
> irrelevant to the end user.  If you resisted the temptation and keep
> reading read-tree page, you see the description of info/sparse-checkout to
> learn how to control the feature, but it does not come with an
> easy-to-follow example.  A few concrete suggestions to "Sparse checkout"
> section in read-tree:
>
> ...
>
Hmm.. yeah. Will do something.
Show 10 quoted lines
> I think the suggestion to use Sparse checkout in git(1)---i.e. your patch
> we are discussing here, is a bit premature before the above happens.
>
>> +... If you need all of them present in working tree, but you
>> +know in advance only a few of them may be modified, please consider
>> +using assume-unchanged bit (see linkgit:git-update-index[1]).
>> +... The following commands are
>> +however known to do full index refresh in some cases:
>
> It is "need to", not "are known to", isn't it?

In case of "git commit", as you said in another mail, index refresh is needed because of post-commit hook. If there are no hooks, I think index refresh can be skipped. But yes, probably "need to".

Show 9 quoted lines
>> +Some commands need entire file content in memory to process.
>> +Files that have size a significant portion of physical RAM may
>> +affect performance. You may want to avoid using the following
>> +commands if possible on such large files:
>
> "If possible" is not a good excuse.  How would one _avoid_ checkout of a
> file if one wants to use it?  You can't.  Similarly to "diff".  This
> advice is pretty much useless, isn't it?  It's not much better than saying
> "if your machine has too little RAM, things will get slow---deal with it".

That's more of bug acknowledgement, or to-be-improved TODOs. I didn't want to say that out loud. Should I?

-- 
Duy
Previous: Junio C Hamano
Message 8 of 8 in “git.txt: document limitations on non-typical repos (and hints)”
  1. git.txt: document limitations on non-typical repos (and hints)Nguyễn Thái Ngọc Duy, Oct 5, 2010
  2. Alex RiesenOct 5, 2010
  3. Chris PackhamOct 5, 2010
  4. Nguyen Thai Ngoc DuyOct 5, 2010
  5. git.txt: document limitations on non-typical repos (and hints)Nguyễn Thái Ngọc Duy, Oct 6, 2010
  6. git.txt: document limitations on non-typical repos (and hints)pclouds@gmail.com, Oct 6, 2010
  7. Junio C HamanoOct 6, 2010
  8. Nguyen Thai Ngoc DuyOct 7, 2010

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.