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

Re: Question about the ahead-behind computation and status

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 15, 2017, 18:30 UTC
Message-ID
<xmqqa7yjrghd.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<d16339e0-54bd-073b-fa4a-7c3a84a025e9@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
> The biggest reason for the 20 seconds is not just the number of
> commits in the ahead/behind but how many commits are walked (including
> common to both branches) before paint_down_to_common() breaks its
> while loop due to queue_has_nonstale().

Hmm, queue_has_nonstale() looks to see if any element is not STALE (where the definition of STALE is "known to be a common ancestor") by potentially checking all elements in the queue. I wonder if we have an opportunity for a trivial optimization? When the caller knows that it dug one level and added the parents that are not stale, it does not have to ask queue_has_nonstale() if there is any non stale element, for example.

What do you exactly mean by "not just the number of commits in the ahead/behind"? Aren't the number of these commits pretty much proportional to the number of commits we need to paint down to common ancestors? Is the latter a lot larger than the former (i.e. are we somehow not stopping when we _could_ notice that we can with better information)?

Previous: Derrick StoleeNext: Derrick Stolee
Message 5 of 6 in “Question about the ahead-behind computation and status”
  1. Jeff HostetlerDec 14, 2017
  2. Jeff KingDec 15, 2017
  3. Jeff HostetlerDec 15, 2017
  4. Derrick StoleeDec 15, 2017
  5. Junio C HamanoDec 15, 2017
  6. Derrick StoleeDec 15, 2017

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.