git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Oct 6, 2012, 12:57 UTC
Message-ID
<20121006125735.GA11712@sigill.intra.peff.net>
In-Reply-To
<7vobkgrxay.fsf@alter.siamese.dyndns.org>
On Fri, Oct 05, 2012 at 10:20:37PM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> >> > @@ -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
Previous: Junio C Hamano
Message 13 of 13 in “git pull takes ~8 seconds on up-to-date Linux git tree”
  1. Markus TrippelsdorfOct 4, 2012
  2. Jeff KingOct 4, 2012
  3. Markus TrippelsdorfOct 4, 2012
  4. Junio C HamanoOct 4, 2012
  5. Junio C HamanoOct 4, 2012
  6. Junio C HamanoOct 4, 2012
  7. Junio C HamanoOct 4, 2012
  8. Junio C HamanoOct 4, 2012
  9. Junio C HamanoOct 4, 2012
  10. Junio C HamanoOct 5, 2012
  11. Jeff KingOct 5, 2012
  12. Junio C HamanoOct 6, 2012
  13. Jeff KingOct 6, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.