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

Re: [PATCH] gc --auto: warn garbage collection happens soon

From
Jeff King <peff@peff.net>
Date
Dec 28, 2011, 18:40 UTC
Message-ID
<20111228184000.GA18780@sigill.intra.peff.net>
In-Reply-To
<7vpqf94r8c.fsf@alter.siamese.dyndns.org>
On Tue, Dec 27, 2011 at 01:52:35PM -0800, Junio C Hamano wrote:
Show 13 quoted lines
> And if the answer to that tongue-in-cheek question is no, what is the
> reason why the users will not find the messages disturbing, while loathing
> the auto-gc?
> 
> I suspect that is because auto-gc takes long time, making the user wait,
> compared to the new message that may be noisy but quick.  Perhaps the real
> cure for the disease is not to add the message but to make an auto-gc less
> painful, no?
> 
> What are the things we could do to make auto-gc less painful?
>
> Are we doing something that is not necessary in auto-gc that takes time
> but that we can live without doing?

I don't personally find gc all that painful (though maybe that is because I tend to gc myself and rarely hit the auto-gc), but I have noticed that git-prune takes by far the most time to run. If you are just doing an incremental pack, you might be packing only a few thousand objects and not touching old history at all (and with many cores, the delta compression flies by). But prune requires running "git rev-list --objects --all", which takes something like 45 seconds for linux-2.6 on my fast-ish laptop (and about 23 seconds for git.git).

We could perhaps cut out pruning in the auto-gc case unless there are a lot of objects left over after the packing phase. It's not worth doing a full prune to clean up a dozen objects[1]. It probably is if you have a thousand objects left after packing.

-Peff
[1] Actually, it's not just having objects. You may have just exploded
    unreachable objects from a pack, but they are still younger than the
    2 week expiration period. Therefore trying to prune them is
    pointless, because even if they are unreachable, you won't delete
    them. So you really want to say "how many actual candidate objects
    do we have for pruning?"
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 8 in “gc --auto: warn garbage collection happens soon”
  1. gc --auto: warn garbage collection happens soonNguyễn Thái Ngọc Duy, Dec 27, 2011
  2. Junio C HamanoDec 27, 2011
  3. Jeff KingDec 28, 2011
  4. Junio C HamanoDec 28, 2011
  5. Jeff KingDec 28, 2011
  6. Nguyen Thai Ngoc DuyDec 28, 2011
  7. Nguyen Thai Ngoc DuyDec 28, 2011
  8. Mark BrownDec 29, 2011

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.