summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b48d5a0)
raw | patch | inline | side by side (parent: b48d5a0)
author | Linus Torvalds <torvalds@linux-foundation.org> | |
Fri, 10 Aug 2007 19:21:20 +0000 (12:21 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 10 Aug 2007 21:00:11 +0000 (14:00 -0700) |
This optimizes bind_merge() and oneway_merge() to not unnecessarily
remove and re-add the old index entries when they can just get replaced
by updated ones.
This makes these operations much faster for large trees (where "large"
is in the 50,000+ file range), because we don't unnecessarily move index
entries around in the index array all the time.
Using the "bummer" tree (a test-tree with 100,000 files) we get:
Before:
[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
real 0m9.470s
user 0m8.729s
sys 0m0.476s
After:
[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
real 0m1.173s
user 0m0.720s
sys 0m0.452s
so for large trees this is easily very noticeable indeed.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remove and re-add the old index entries when they can just get replaced
by updated ones.
This makes these operations much faster for large trees (where "large"
is in the 50,000+ file range), because we don't unnecessarily move index
entries around in the index array all the time.
Using the "bummer" tree (a test-tree with 100,000 files) we get:
Before:
[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
real 0m9.470s
user 0m8.729s
sys 0m0.476s
After:
[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
real 0m1.173s
user 0m0.720s
sys 0m0.452s
so for large trees this is easily very noticeable indeed.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c | patch | blob | history |
diff --git a/unpack-trees.c b/unpack-trees.c
index 5e457b0bc919c746405a0ec106cdc02d47fd1ff9..d57b91c1b2738f205d7997cc67f25f594ff3e5ed 100644 (file)
--- a/unpack-trees.c
+++ b/unpack-trees.c
struct cache_entry *old = src[0];
struct cache_entry *a = src[1];
- remove_entry(remove);
if (o->merge_size != 1)
return error("Cannot do a bind merge of %d trees\n",
o->merge_size);
struct cache_entry *old = src[0];
struct cache_entry *a = src[1];
- remove_entry(remove);
if (o->merge_size != 1)
return error("Cannot do a oneway merge of %d trees",
o->merge_size);
- if (!a)
+ if (!a) {
+ remove_entry(remove);
return deleted_entry(old, old, o);
+ }
if (old && same(old, a)) {
if (o->reset) {
struct stat st;