{"thread":{"id":"24430","subject":"git diff slow after initial checkout","startedAt":"2010-07-18T14:17:19Z","lastAt":"2010-07-18T14:17:19Z","messageCount":1,"participants":["Michel Lespinasse"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"145750","messageId":"20100718141719.GA32660@google.com","threadId":"24430","inReplyTo":null,"subject":"git diff slow after initial checkout","fromName":"Michel Lespinasse","fromEmail":"walken@google.com","sentAt":"2010-07-18T14:17:19Z","receivedAt":"2010-07-18T14:17:19Z","isPatch":false,"sender":{"key":"walken@google.com","avatar":null},"body":"Hi,\n\nI am seeing a slow 'git diff' when doing the following with git 1.7.0.4:\n\n% git clone /path/to/repo\n% cd repo\n% git checkout e0d960b\n% time git diff | cat\ngit diff  0.15s user 0.30s system 96% cpu 0.468 total\ncat  0.00s user 0.00s system 0% cpu 0.467 total\n% strace -o ../strace.before git diff | cat\n% touch .git/index\n% time git diff | cat\ngit diff  0.00s user 0.00s system 0% cpu 0.006 total\ncat  0.00s user 0.00s system 0% cpu 0.005 total\n% strace -o ../strace.after git diff | cat\n\nThe first diff is ~100 times slower than what git has gotten me used to.\nIf I run the diff multiple times, it stays slow every time until I touch\nthe index.\n\nThe strace shows that before I touch the index, 'git diff' mmaps .git/index\nand then does an lstat/open/read/close loop on every file in the repository.\nAfter I touch the index, 'git diff' only does an lstat on every file.\n\n\nIt looks like 'git checkout' should touch the index file after it's done ?\n\nAlternatively, maybe 'git diff' should do that after it notices there are\nno modified files ?\n\nIs this fixed with a more recent version of git ? (in RelNotes-1.7.1.1.txt\nI see something about 'git status' stopped refreshing the index by mistake\nin git 1.7.1, which sounds like the same problem but in a different place ?)\n\n-- \nMichel \"Walken\" Lespinasse\nA program is never fully debugged until the last user dies.\n"}]}