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

Re: gc --aggressive

From
Jeff King <peff@peff.net>
Date
May 1, 2012, 20:01 UTC
Message-ID
<20120501200123.GB26245@sigill.intra.peff.net>
In-Reply-To
<7vr4v391s1.fsf@alter.siamese.dyndns.org>
On Tue, May 01, 2012 at 11:47:26AM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> > While keeping the size comparison commented out, you could try to 
> > replace this line with:
> >
> > 	return b < a ? -1 : (b > a);
> >
> > If this doesn't improve things then it would be clear that this avenue 
> > should be abandoned.
> 
> Very interesting.  The difference between the two should only matter if
> there are many blobs with exactly the same size, and most of them delta
> horribly with each other.  Does the problematic repository exhibit such
> a characteristic?
No. Here are the objects with the same sizes:
  $ git rev-list --objects --all |
    cut -d' ' -f1 |
    git cat-file --batch-check |
    cut -d' ' -f2,3 |
    sort | uniq -c | sort -rn | head
  19722 tree 2222
  14068 tree 4393
  11418 tree 2156
   9994 tree 4676
   9479 tree 2189
   7944 tree 2255
   6454 commit 251
   6437 tree 4611
   5328 tree 4439
   4586 commit 254

So it's mostly trees and commits (the first repeated blob size is on line 332 of the output). The commits aren't all that big even without deltafication, but the trees are. They should be sorted by name_hash, but within a single name, there are going to be a lot of repetitions (I think each of those size clusters is just a repetition of the same "po" directory getting lots of tiny modifications).

So we are triggering that part of the sort quite a bit. But by your reasoning here:

Show 7 quoted lines
> The original tie-breaks based on the address (the earlier object we read
> in the original input comes earlier in the output) and yours make the
> objects later we read (which in turn are from older parts of the history)
> come early, but adjacency between two objects of the same type and the
> same size would not change (if A and B were next to each other in this
> order, your updated sorter will give B and then A still next to each
> other), so I suspect not much would change in the candidate selection.

I don't think it makes a big difference (and indeed, switching it and repacking the phpmyadmin repository yields the same-size pack, although a lot more CPU time is spent).

-Peff
Previous: Nicolas PitreNext: Jeff King
Message 14 of 26 in “gc --aggressive”
  1. Jay SoffianApr 17, 2012
  2. Jay SoffianApr 17, 2012
  3. Matthieu MoyApr 17, 2012
  4. Jeff KingApr 17, 2012
  5. Jeff KingApr 28, 2012
  6. Nicolas PitreApr 28, 2012
  7. Jeff KingApr 29, 2012
  8. Nicolas PitreApr 29, 2012
  9. Jeff KingMay 1, 2012
  10. Jeff KingMay 1, 2012
  11. Nicolas PitreMay 1, 2012
  12. Junio C HamanoMay 1, 2012
  13. Nicolas PitreMay 1, 2012
  14. Jeff KingMay 1, 2012
  15. Jeff KingMay 1, 2012
  16. Nicolas PitreMay 1, 2012
  17. Nicolas PitreMay 1, 2012
  18. Jeff KingMay 1, 2012
  19. Nicolas PitreMay 1, 2012
  20. Nicolas PitreApr 28, 2012
  21. Jeff KingApr 17, 2012
  22. Junio C HamanoApr 17, 2012
  23. Jeff KingApr 17, 2012
  24. Junio C HamanoApr 17, 2012
  25. Nicolas PitreApr 28, 2012
  26. Andreas EricssonApr 18, 2012

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.