]> git.ipfire.org Git - thirdparty/git.git/commit - Makefile
Avoid accessing a slow working copy during diffcore operations.
authorShawn O. Pearce <spearce@spearce.org>
Thu, 14 Dec 2006 11:15:57 +0000 (06:15 -0500)
committerJunio C Hamano <junkio@cox.net>
Sat, 16 Dec 2006 06:11:19 +0000 (22:11 -0800)
commit1510fea781cb0517eeba8c378964f7bc4f9577ab
tree80be67e623e96f28290834a443c5dd685952115d
parent1576f5f7b2addd648a41fb5cfbcd2e6d632b7461
Avoid accessing a slow working copy during diffcore operations.

The Cygwin folks have done a fine job at creating a POSIX layer
on Windows That Just Works(tm).  However it comes with a penalty;
accessing files in the working tree by way of stat/open/mmap can
be slower for diffcore than inflating the data from a blob which
is stored in a packfile.

This performance problem is especially an issue in merge-recursive
when dealing with nearly 7000 added files, as we are loading
each file's content from the working directory to perform rename
detection.  I have literally seen (and sadly watched) paint dry in
less time than it takes for merge-recursive to finish such a merge.
On the other hand this very same merge runs very fast on Solaris.

If Git is compiled with NO_FAST_WORKING_DIRECTORY set then we will
avoid looking at the working directory when the blob in question
is available within a packfile and the caller doesn't need the data
unpacked into a temporary file.

We don't use loose objects as they have the same open/mmap/close
costs as the working directory file access, but have the additional
CPU overhead of needing to inflate the content before use.  So it
is still faster to use the working tree file over the loose object.

If the caller needs the file data unpacked into a temporary file
its likely because they are going to call an external diff program,
passing the file as a parameter.  In this case reusing the working
tree file will be faster as we don't need to inflate the data and
write it out to a temporary file.

The NO_FAST_WORKING_DIRECTORY feature is enabled by default on
Cygwin, as that is the platform which currently appears to benefit
the most from this option.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Makefile
diff.c