aboutsummaryrefslogtreecommitdiff
path: root/builtin/diff-index.c
diff options
context:
space:
mode:
authorKarsten Blees <blees@dcon.de>2012-10-30 10:50:42 +0100
committerJeff King <peff@peff.net>2012-11-02 11:38:29 -0400
commit7349afd20e3b0ce3da6f192f593390472acec9d3 (patch)
treeef4d2b60cb0cad38f4f6f68640a55b26105790da /builtin/diff-index.c
parent7e2010537e96d0a1144520222f20ba1dc3d61441 (diff)
downloadgit-7349afd20e3b0ce3da6f192f593390472acec9d3.tar.gz
git-7349afd20e3b0ce3da6f192f593390472acec9d3.tar.xz
update-index/diff-index: use core.preloadindex to improve performance
'update-index --refresh' and 'diff-index' (without --cached) don't honor the core.preloadindex setting yet. Porcelain commands using these (such as git [svn] rebase) suffer from this, especially on Windows. Use read_cache_preload to improve performance. Additionally, in builtin/diff.c, don't preload index status if we don't access the working copy (--cached). Results with msysgit on WebKit repo (2GB in 200k files): | update-index | diff-index | rebase ----------------+--------------+------------+--------- msysgit-v1.8.0 | 9.157s | 10.536s | 42.791s + preloadindex | 9.157s | 10.536s | 28.725s + this patch | 2.329s | 2.752s | 15.152s + fscache [1] | 0.731s | 1.171s | 8.877s [1] https://github.com/kblees/git/tree/kb/fscache-v3 Thanks-to: Albert Krawczyk <pro-logic@optusnet.com.au> Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'builtin/diff-index.c')
-rw-r--r--builtin/diff-index.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 2eb32bd9d..1c737f792 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -41,9 +41,13 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
if (rev.pending.nr != 1 ||
rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1)
usage(diff_cache_usage);
- if (!cached)
+ if (!cached) {
setup_work_tree();
- if (read_cache() < 0) {
+ if (read_cache_preload(rev.diffopt.pathspec.raw) < 0) {
+ perror("read_cache_preload");
+ return -1;
+ }
+ } else if (read_cache() < 0) {
perror("read_cache");
return -1;
}