From: Michel Lespinasse <walken@google.com>
To: git@vger.kernel.org
Subject: git diff slow after initial checkout
Date: Sun, 18 Jul 2010 07:17:19 -0700 [thread overview]
Message-ID: <20100718141719.GA32660@google.com> (raw)
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.
reply other threads:[~2010-07-18 14:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20100718141719.GA32660@google.com \
--to=walken@google.com \
--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).