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

Re: git performance after directory copy

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 20, 2010, 09:56 UTC
Message-ID
<vpq62y0hh63.fsf@bauges.imag.fr>
In-Reply-To
<C5A8FDEFF7647F4C9CB927D7DEB307730F33B7C9@ahr075s.basler.corp>
"Gaer, A." <Andreas.Gaer@baslerweb.com> writes:
> On a copied source directory "git status" seems to be about
> 3 times slower than on the original directory.

It is expected that the first "git status" be slower. It will most likely have to actually re-diff the files and update the index stat-cache.

But I'm surprised that the next "git status" are still slow. Other people may get a better explanation, but this very much looks like a bug.

Are you sure you don't have any permission problem, like a read-only .git/index?

To investigate a bit, you can play with diff.autorefreshindex. When set to false, "git diff" will tell you about the files which are identical, but do not have the same stat information (and hence, that Git has to re-diff). For example:

$ git config diff.autorefreshindex false $ git diff

# no output: bar.txt exists, but is up to date.

$ touch bar.txt $ git diff

diff --git a/bar.txt b/bar.txt

# No actual diff, but the file appears since its stat information is
# different.

$ git diff
diff --git a/bar.txt b/bar.txt

# Further "git diff" behave the same.

$ git status
...
$ git diff  

# git status did update the stat-cache, hence, no output from git diff
# anymore.

Another diagnosis tool would be "strace -e open git status,lstat64".
For example:

$ touch bar.txt 
$ strace -e open,lstat64 git status |& grep bar.txt
lstat64("bar.txt", {st_mode=S_IFREG|0644, st_size=30, ...}) = 0
open("bar.txt", O_RDONLY|O_LARGEFILE)   = 3
$ strace -e open,lstat64 git status |& grep bar.txt
lstat64("bar.txt", {st_mode=S_IFREG|0644, st_size=30, ...}) = 0
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Michael J GruberNext: Michael J Gruber
Message 3 of 8 in “git performance after directory copy”
  1. Gaer, A.Sep 20, 2010
  2. Michael J GruberSep 20, 2010
  3. Matthieu MoySep 20, 2010
  4. Michael J GruberSep 20, 2010
  5. AW: git performance after directory copyGaer, A., Sep 20, 2010
  6. Johannes SixtSep 20, 2010
  7. AW: git performance after directory copyGaer, A., Sep 20, 2010
  8. Matthieu MoySep 20, 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.