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

Re: [PATCH v2] rev-list --disk-usage

From
Jeff King <peff@peff.net>
Date
Feb 10, 2021, 09:38 UTC
Message-ID
<YCOpq5fDYp+YEzEu@coredump.intra.peff.net>
In-Reply-To
<xmqq8s7x0wra.fsf@gitster.c.googlers.com>
On Tue, Feb 09, 2021 at 01:14:17PM -0800, Junio C Hamano wrote:
Show 18 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > I don't know that it's really worth digging into that much, though it's
> > quite possible there may be some easy wins by optimizing those memcpy
> > calls. E.g., I'm not sure if the compiler ends up inlining them or not.
> > If it doesn't realize that the_hash_algo->rawsz is only ever "20" or
> > "32", we could perhaps help it along with specialized versions of
> > hashcpy(). If somebody does want to play with it, this patch may make a
> > good testbed. :)
> 
> Yuck.  That reminds me of the adventure Shawn he made in the Java
> land benchmarking which one among int[5], int a,b,c,d,e, char[40] is
> the most efficient way (both storage-wise and performance-wise) to
> store SHA-1 hash.  I wish we didn't have to go there.
> 
> It indeed is an interesting, despite a bit sad, observation that
> even with a good precomputed information, an overly heavy interface
> can kill potential performance benefit.

Agreed. But I'm hoping we can continue to mostly ignore it. I suspect this finding means we are wasting a few hundred milliseconds copying oids around during a clone of torvalds/linux. But overall that is a pretty heavy-weight operation, and I doubt anybody really notices. And for something as lightweight as --disk-usage, it was easy enough to optimize around it.

It probably does have a more measurable impact in something like:
  git rev-list --use-bitmap-index --objects HEAD >/dev/null

where we really do need those oids, and the extra copying might add up. I guess if somebody is interested in micro-optimizing, that is probably a good command to look at.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 17 of 30 in “rev-list --disk-usage”
  1. 0/2 rev-list --disk-usageJeff King, Jan 27, 2021
  2. 1/2 t: add --no-tag option to test_commitJeff King, Jan 27, 2021
  3. Taylor BlauJan 27, 2021
  4. 2/2 rev-list: add --disk-usage option for calculating disk usageJeff King, Jan 27, 2021
  5. Taylor BlauJan 27, 2021
  6. Jeff KingJan 27, 2021
  7. Eric SunshineJan 27, 2021
  8. Jeff KingJan 27, 2021
  9. Kyle MeyerJan 27, 2021
  10. Jeff KingJan 27, 2021
  11. Taylor BlauJan 27, 2021
  12. rev-list --disk-usageJeff King, Feb 9, 2021
  13. 1/2 t: add --no-tag option to test_commitJeff King, Feb 9, 2021
  14. 2/2 rev-list: add --disk-usage option for calculating disk usageJeff King, Feb 9, 2021
  15. Jeff KingFeb 9, 2021
  16. Junio C HamanoFeb 9, 2021
  17. Jeff KingFeb 10, 2021
  18. Junio C HamanoFeb 10, 2021
  19. Taylor BlauFeb 10, 2021
  20. Jeff KingFeb 10, 2021
  21. Junio C HamanoFeb 10, 2021
  22. Jeff KingFeb 10, 2021
  23. Taylor BlauFeb 10, 2021
  24. Jeff KingFeb 11, 2021
  25. Ævar Arnfjörð BjarmasonFeb 11, 2021
  26. Junio C HamanoFeb 11, 2021
  27. 0/2 rev-list --disk-usage example docsJeff King, Feb 17, 2021
  28. 1/2 docs/rev-list: add an examples sectionJeff King, Feb 17, 2021
  29. 2/2 docs/rev-list: add some examples of --disk-usageJeff King, Feb 17, 2021
  30. Taylor BlauFeb 17, 2021

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.