Re: [PATCH 0/3] Un-pessimize "diff-index $commit -- $pathspec"
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:56
Linus Torvalds [off-list ref] writes:
On Mon, Aug 29, 2011 at 2:33 PM, Junio C Hamano [off-list ref] wrote:quoted
Before and after applying this series, looking for changes in the kernel repository with a fairly narrow pathspec gets a moderate speeds up."moderate speeds up"? Looks like a big win to me. Admittedly it's already a pretty fast operation, but script it and repeat it a million times, and that will matter a lot more. I guess the "--raw" diff part means that you are hiding the time to make a real diff, which would otherwise swamp everything else. Even so, this looks like a good improvement.
The topic started by Marat Radchenko in
http://thread.gmane.org/gmane.comp.version-control.git/179926
who was trying to pick a single path (we do not know how deep it is), and
was comparing between these two:
$ 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
Replacing "diff -u" with "git diff --no-index" in the former didn't make
much of a difference. It turned out that Marat had 603k paths in the index
and the most of the time was spent in the unpack machinery.