From: Michael J Gruber Date: Tue, 23 Aug 2011 10:03:28 GMT Subject: Re: What's the difference between `git show branch:file | diff -u - file` vs `git diff branch file`? Message-ID: <4E537AF0.9070604@drmicha.warpmail.net> In-Reply-To: Marat Radchenko venit, vidit, dixit 23.08.2011 09:25: > $ 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