Re: What's the difference between `git show branch:file | diff -u - file` vs `git diff branch file`?
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Aug 23, 2011, 10:03 UTC
- Message-ID
- <4E537AF0.9070604@drmicha.warpmail.net>
- In-Reply-To
- <loom.20110823T091132-107@post.gmane.org>
Marat Radchenko venit, vidit, dixit 23.08.2011 09:25:
Show 18 quoted lines
> $ time git show branch:file | diff -u - file > /dev/null > > real 0m0.003s > user 0m0.000s > sys 0m0.000s > > $ time git diff branch -- file > /dev/null > > real 0m31.442s > user 0m31.040s > sys 0m0.380s > > What does git diff do so it takes that much time? And is there any flag to git > diff so that it will work as fast as show + diff? I thought these two are > equivalent but from run time it is obvious that they aren't. > > gprof output: http://slonopotamus.org/git-diff/git-diff-branch.gprof.txt >
Is that a very large tree or a very slow file system?
>From the gprof output, it would appear that we compare a lot of cache
entries (or rather: spent most time on...). Do we enumerate all differing files and only then limit diff output by path??
Michael