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

From: Jeff King <[email-masked]>
Date: Fri, 29 May 2026 04:43:25 -0400

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)?

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.

-Peff