public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web•de>
To: Jeff King <peff@peff•net>
Cc: Git List <git@vger•kernel.org>
Subject: Re: [PATCH] commit-reach: stop sorting in paint_down_to_common()
Date: Fri, 29 May 2026 17:32:58 +0200	[thread overview]
Message-ID: <107314f5-0057-4ed3-9bee-9dca4f424bd1@web.de> (raw)
In-Reply-To: <20260529084325.GF1106035@coredump.intra.peff.net>

On 5/29/26 10:43 AM, Jeff King wrote:
> 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é


  reply	other threads:[~2026-05-29 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 15:52 [PATCH] commit-reach: stop sorting in paint_down_to_common() René Scharfe
2026-05-29  8:43 ` Jeff King
2026-05-29 15:32   ` René Scharfe [this message]
2026-05-29 19:04     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=107314f5-0057-4ed3-9bee-9dca4f424bd1@web.de \
    --to=l.s.r@web$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox