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

Re: [PATCH 2/2] --pretty=format: on-demand format expansion

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Nov 10, 2007, 11:12 UTC
Message-ID
<47359221.7090707@lsrfire.ath.cx>
In-Reply-To
<20071110004635.GA14992@sigill.intra.peff.net>
Jeff King schrieb:
Show 15 quoted lines
> On Sat, Nov 10, 2007 at 12:16:30AM +0100, René Scharfe wrote:
> 
>>> A partial patch on top of yours is below (it caches commit and tree 
>>> abbreviations; parent abbreviations and person-parsing are probably 
>>> worth doing). Some timings:
>> ... but I object to the choice of items to cache.  Are there real-world
>> formats containing the same placeholder twice or even more often?
> 
> My choice of items was more "here is what I am talking about" and not
> "this is the best set of items."
> 
> As for what real-world workloads are like, part of the _point_ of
> --pretty=format: is for one-off formats that users use in their
> workflow. So yes, I have used formats that repeat specifiers, but they
> are probably not common.
Hmm, OK.
> The point of my timings was to show not only that we sped up that
> uncommon case, but that there was negligible cost to the common case.
> And since we don't know what formats users will provide, it makes sense
> not to have lousy performance on the uncommon.

My suspicion was that it's more like "never used" rather than "uncommon". Since you're a duplicate placeholder user, it's not "never" any more. :)

Show 6 quoted lines
>> There is probably more to gain from the interdependencies of different
>> placeholders.  The patch below attempts to avoid parsing the commit
>> twice, by saving pointers to the different parts.
> 
> Looks sane, although I don't see any reason this couldn't just go on top
> of my patch, and then we can speed up both cases.

Yes, the two are independent. I don't like the malloc()'s in your patch, though, and have cooked up a different one on top of a cleaned up version of mine. It plays the dirty trick of reading expansions of repeated placeholders from the strbuf..

René
Previous: Jeff KingNext: Johannes Schindelin
Message 11 of 24 in “--pretty=format: on-demand format expansion”
  1. 2/2 --pretty=format: on-demand format expansionRené Scharfe, Nov 9, 2007
  2. Johannes SchindelinNov 9, 2007
  3. René ScharfeNov 9, 2007
  4. Johannes SchindelinNov 9, 2007
  5. Junio C HamanoNov 9, 2007
  6. Jeff KingNov 9, 2007
  7. René ScharfeNov 9, 2007
  8. Johannes SchindelinNov 10, 2007
  9. Jeff KingNov 10, 2007
  10. Jeff KingNov 10, 2007
  11. René ScharfeNov 10, 2007
  12. Johannes SchindelinNov 10, 2007
  13. René ScharfeNov 10, 2007
  14. Jeff KingNov 10, 2007
  15. Jeff KingNov 10, 2007
  16. Jeff KingNov 11, 2007
  17. 1/3 --pretty=format: parse commit message only onceRené Scharfe, Nov 10, 2007
  18. 2/3 add strbuf_adddup()René Scharfe, Nov 10, 2007
  19. 3/3 --format=pretty: avoid calculating expensive expansions twiceRené Scharfe, Nov 10, 2007
  20. Junio C HamanoNov 11, 2007
  21. Jeff KingNov 9, 2007
  22. René ScharfeNov 9, 2007
  23. Jeff KingNov 10, 2007
  24. Paul MackerrasNov 9, 2007

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.