Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git pull takes ~8 seconds on up-to-date Linux git tree

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:56

Jeff King [off-list ref] writes:
On Thu, Oct 04, 2012 at 04:14:54PM +0200, Markus Trippelsdorf wrote:
quoted
with current trunk I get the following on an up-to-date Linux tree:

markus@x4 linux % time git pull
Already up-to-date.
git pull  7.84s user 0.26s system 92% cpu 8.743 total

git version 1.7.12 is much quicker:

markus@x4 linux % time git pull
Already up-to-date.
git pull  0.10s user 0.02s system 16% cpu 0.740 total
Yikes. I can easily reproduce here. Bisecting between master and
v1.7.12 gives a curious result: the slowdown first occurs with the merge
commit 34f5130 (Merge branch 'jc/merge-bases', 2012-09-11). But neither
of its parents is slow. I don't see anything obviously suspect in the
merge, though.
I think the following is likely to be the correct solution to this.

 commit.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git i/commit.c w/commit.c
index 0246767..e1dd5b9 100644
--- i/commit.c
+++ w/commit.c
@@ -733,6 +733,9 @@ static int remove_redundant(struct commit **array, int cnt)
 	int *filled_index;
 	int i, j, filled;
 
+	if (cnt < 2)
+		return cnt;
+
 	work = xcalloc(cnt, sizeof(*work));
 	redundant = xcalloc(cnt, 1);
 	filled_index = xmalloc(sizeof(*filled_index) * (cnt - 1));
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help