git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yissachar Radcliffe <yissachar@block.xyz>
To: git@vger.kernel.org
Subject: Slow git add . performance in large repo
Date: Mon, 17 Mar 2025 14:53:10 -0400	[thread overview]
Message-ID: <CAOHNGAW7ucD+xqvEuvq2GHMc42+WdKJX44XGguadK_y=pMf0Vg@mail.gmail.com> (raw)

We have a relatively large git repo and have noticed that `git add .`
operations are slow (~1.5-2s). We have core.fsmonitor and
core.untrackedCache set to true and `git status` executes in ~300ms.
When I turn on trace2 I can see that almost all the time is spent in
read_directo and it's visiting 26960 directories and 77989 paths.

I can use `git add <foo>` or `git add -u .` to speed things up but
`git add .` is the most convenient for us. I created a small script to
pipe the results of `git status` to `git add` and that runs in <500ms.
This leaves me confused as to why the built-in performance is so slow.

git version is 2.49.0, mac os x 15.3

             reply	other threads:[~2025-03-17 18:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 18:53 Yissachar Radcliffe [this message]
2025-03-17 23:00 ` Slow git add . performance in large repo brian m. carlson
2025-03-18  2:04   ` Yissachar Radcliffe
2025-03-18 21:06     ` brian m. carlson

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOHNGAW7ucD+xqvEuvq2GHMc42+WdKJX44XGguadK_y=pMf0Vg@mail.gmail.com' \
    --to=yissachar@block.xyz \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).