Re: [PATCH] commit-reach: stop sorting in paint_down_to_common()
- From
Jeff King <peff@peff.net>
- Date
- May 29, 2026, 19:04 UTC
- Message-ID
- <20260529190453.GA1711766@coredump.intra.peff.net>
- In-Reply-To
- <107314f5-0057-4ed3-9bee-9dca4f424bd1@web.de>
On Fri, May 29, 2026 at 05:32:58PM +0200, René Scharfe wrote:
Show 6 quoted lines
> > 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.
Yeah. I thought it was only one line (where we append to "tail"), but there are a couple spots where "result" is referenced directly.
Another fun fact: it looks like paint_down_to_common() makes sure to clean up the output list before returning an error. But the callers do so, too, which is redundant. That would go away if they just passed in NULL. :)
-Peff