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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

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

Jeff King [off-list ref] writes:
quoted
quoted
@@ -617,6 +618,8 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n, struc
 
 	one->object.flags |= PARENT1;
 	commit_list_insert_by_date(one, &list);
+	if (!n)
+		return list;
 	for (i = 0; i < n; i++) {
 		twos[i]->object.flags |= PARENT2;
 		commit_list_insert_by_date(twos[i], &list);
This seems like an obvious optimization, but does it really have
anything to do with the patch at hand?
The function picks one and paints it against all others, but the
logic assumes there must be at least one other to paint against;
otherwise the traversal will not ever find a node that is painted
with both PARENT1 and PARENT2 to stop, leading us to traverse all
the way down to root.

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

From: Jeff King <hidden>
Date: 2016-06-15 22:54:57

On Fri, Oct 05, 2012 at 10:20:37PM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
quoted
quoted
@@ -617,6 +618,8 @@ static struct commit_list *paint_down_to_common(struct commit *one, int n, struc
 
 	one->object.flags |= PARENT1;
 	commit_list_insert_by_date(one, &list);
+	if (!n)
+		return list;
 	for (i = 0; i < n; i++) {
 		twos[i]->object.flags |= PARENT2;
 		commit_list_insert_by_date(twos[i], &list);
This seems like an obvious optimization, but does it really have
anything to do with the patch at hand?
The function picks one and paints it against all others, but the
logic assumes there must be at least one other to paint against;
otherwise the traversal will not ever find a node that is painted
with both PARENT1 and PARENT2 to stop, leading us to traverse all
the way down to root.
Ah, OK. I was thinking it was just a way to skip the further logic,
which would come to the same answer (it does, just not quickly). Makes
sense.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help