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

Re: [PATCH] ref-filter: fix stale parsed objects

From
Jeff King <peff@peff.net>
Date
Nov 4, 2025, 21:11 UTC
Message-ID
<20251104211130.GA2618884@coredump.intra.peff.net>
In-Reply-To
<xmqqpl9xps3x.fsf@gitster.g>
On Tue, Nov 04, 2025 at 10:31:14AM -0800, Junio C Hamano wrote:
Show 10 quoted lines
> > As reported by Junio in <xmqqo6pjt2wn.fsf@gitster.g>. This applies
> > directly on top of ps/ref-peeled-tags at 054f5f457e (ref-filter: parse
> > objects on demand, 2025-10-23)
> >
> > Thanks!
> 
> Thanks.  As we stop reusing a stale maybe_object and instead start
> parsing the right object when we need to, I wondered if the "on
> demand" commit needs a new benchmark, but the example cited in the
> message used %(raw) so it would not be affected, I guess.

Yeah. The point was to speed up stuff like %(raw) that needs the object contents but doesn't want to do the parse. So it never looked at maybe_object in the first place, which is why it got faster.

I actually wonder if there is any other placeholder that benefits at all. The ref-filter code already tries to avoid doing unneeded work. The most obvious there is not loading the object at all, which is why stuff like "%(refname) %(objectname)" is faster than adding in %(raw), which needs the object contents (but no parsing). And likewise stuff like %(tag) needs parsing, and thus also triggers loading the object.

So 054f5f457e helps formats which require the object contents but _not_ parsing. I can't think of another placeholder besides %(raw) which would benefit from that.

What _would_ help more formats is doing the parsing more progressively, skipping parts that aren't needed. If you just want %(tree), for example, then:

  1. You don't need to look at non-commit objects.
  2. You can stop parsing the commit objects after the "tree" line.

But doing that is more involved. So not an argument against the patch, but just noting its limitations. ;)

I think the parser in pretty.c tries to be a bit more careful here. It would be nice if we could unify these.

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 4 of 7 in “ref-filter: fix stale parsed objects”
  1. ref-filter: fix stale parsed objectsPatrick Steinhardt, Nov 4, 2025
  2. Junio C HamanoNov 4, 2025
  3. Junio C HamanoNov 4, 2025
  4. Jeff KingNov 4, 2025
  5. Jeff KingNov 4, 2025
  6. Patrick SteinhardtNov 6, 2025
  7. Jeff KingNov 4, 2025

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.