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

Re: [PATCH] commit-reach: stop sorting in paint_down_to_common()

From
René Scharfe <l.s.r@web.de>
Date
May 29, 2026, 15:32 UTC
Message-ID
<107314f5-0057-4ed3-9bee-9dca4f424bd1@web.de>
In-Reply-To
<20260529084325.GF1106035@coredump.intra.peff.net>
On 5/29/26 10:43 AM, Jeff King wrote:
Show 11 quoted lines
> On Wed, May 27, 2026 at 05:52:17PM +0200, René Scharfe wrote:
> 
>> None of the three callers of paint_down_to_common() care about the order
>> of its result list: merge_bases_many() sorts it again after removing
>> stale items, remove_redundant_no_gen() and repo_in_merge_bases_many()
>> throw the list away without even looking at it.  So drop the unnecessary
>> commit_list_sort_by_date() call.
> 
> Seems like an easy win. If some of the callers do not even look at the
> result, could we avoid building it at all in those cases (e.g., by
> passing in a NULL result pointer)?

Yes, at the cost of adding NULL checks to paint_down_to_common(). Which is probably worth it.

> I guess there is not much to be gained, though. The result is a list of
> merge bases, so it should usually be rather small. The benefit in your
> patch is probably not performance, but just reducing the size of the
> code.

True. The list can be arbitrarily long, but should only contain a handful commits in normal repos.

René
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “commit-reach: stop sorting in paint_down_to_common()”
  1. commit-reach: stop sorting in paint_down_to_common()René Scharfe, May 27, 2026
  2. Jeff KingMay 29, 2026
  3. René ScharfeMay 29, 2026
  4. Jeff KingMay 29, 2026

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.