* git diff slow after initial checkout
@ 2010-07-18 14:17 Michel Lespinasse
0 siblings, 0 replies; only message in thread
From: Michel Lespinasse @ 2010-07-18 14:17 UTC (permalink / raw)
To: git
Hi,
I am seeing a slow 'git diff' when doing the following with git 1.7.0.4:
% git clone /path/to/repo
% cd repo
% git checkout e0d960b
% time git diff | cat
git diff 0.15s user 0.30s system 96% cpu 0.468 total
cat 0.00s user 0.00s system 0% cpu 0.467 total
% strace -o ../strace.before git diff | cat
% touch .git/index
% time git diff | cat
git diff 0.00s user 0.00s system 0% cpu 0.006 total
cat 0.00s user 0.00s system 0% cpu 0.005 total
% strace -o ../strace.after git diff | cat
The first diff is ~100 times slower than what git has gotten me used to.
If I run the diff multiple times, it stays slow every time until I touch
the index.
The strace shows that before I touch the index, 'git diff' mmaps .git/index
and then does an lstat/open/read/close loop on every file in the repository.
After I touch the index, 'git diff' only does an lstat on every file.
It looks like 'git checkout' should touch the index file after it's done ?
Alternatively, maybe 'git diff' should do that after it notices there are
no modified files ?
Is this fixed with a more recent version of git ? (in RelNotes-1.7.1.1.txt
I see something about 'git status' stopped refreshing the index by mistake
in git 1.7.1, which sounds like the same problem but in a different place ?)
--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-18 14:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-18 14:17 git diff slow after initial checkout Michel Lespinasse
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.