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

Re: [PATCH 2/2] log: do not shorten decoration names too early

From
Jeff King <peff@peff.net>
Date
May 14, 2015, 18:10 UTC
Message-ID
<20150514181008.GA8486@peff.net>
In-Reply-To
<xmqqzj576nts.fsf@gitster.dls.corp.google.com>
On Thu, May 14, 2015 at 11:01:03AM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> > So with your slab_peek() below, I'd guess that the slab would actually
> > be faster. But I'd also be unsurprised if it makes no appreciable
> > difference to the overall runtime of "git log --decorate". I think we'd
> > have to build it and profile (and please feel free to say "eh, not worth
> > the time to think about further").
> 
> While I think *slabname##_peek() would be worth doing regardless of
> this caller, I suspect that the major overhead of decorate code
> would come from the for_each_ref() that jumps deep into the history
> to parse old commits; it would trigger a lot of unpacking of objects
> deep in the delta chain, which would be expensive than table look-up
> in either scheme.

That would depend on the particular repository and traversal. The expensive "load an old commit" work is done once per ref in the repo. The lookup work is done once per commit traversed. So even if the latter is much less work, we are typically doing it many more times, and there is probably a balance point.

But I suspect all of it compares to the actual work of a "git log" which has to read all of the commits we are looking at anyway. IOW, we are probably talking about optimizing 1%, while the other 99% is spent on inflate(), etc.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 17 in “"HEAD -> branch" decoration doesn't work with "--decorate=full"”
  1. Michael HaggertyMay 13, 2015
  2. Junio C HamanoMay 13, 2015
  3. Michael J GruberMay 13, 2015
  4. Junio C HamanoMay 13, 2015
  5. Junio C HamanoMay 13, 2015
  6. 2/2 log: do not shorten decoration names too earlyJunio C Hamano, May 13, 2015
  7. Jeff KingMay 14, 2015
  8. Junio C HamanoMay 14, 2015
  9. Jeff KingMay 14, 2015
  10. Junio C HamanoMay 14, 2015
  11. Jeff KingMay 14, 2015
  12. Junio C HamanoMay 14, 2015
  13. Jeff KingMay 14, 2015
  14. Junio C HamanoMay 14, 2015
  15. Jeff KingMay 14, 2015
  16. Junio C HamanoMay 22, 2015
  17. Jeff KingMay 22, 2015

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.