Re: gc --aggressive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 28 Apr 2012, Jeff King wrote:

> On Tue, Apr 17, 2012 at 10:52:03PM +0200, Matthieu Moy wrote:
> 
> > Jay Soffian <jaysoffian@xxxxxxxxx> writes:
> > 
> > > + 3. `git gc --aggressive`; this is often much slower than (2) because git
> > > +    throws out all of the existing deltas and recomputes them from
> > > +    scratch. It uses a higher window parameter meaning it will spend
> > > +    more time computing, and it may end up with a smaller pack. However,
> > > +    unless the repository is known to have initially been poorly packed,
> > > +    this option is not needed and will just cause git to perform
> > > +    extra work.
> > 
> > I like your patch.
> > 
> > Maybe you should elaborate on "unless the repository is known to have
> > initially been poorly packed". My understanding is that --aggressive was
> > implemented to be called after an import from another VCS that would
> > have computed very poor deltas, but I'm not sure about the details.

This is somewhat subjective of course.  But to be effective, you need 
sufficient resources to repack with --aggressive, otherwise you may 
potentially end up with a worse pack.

> Coincidentally, I came across a case last week that shows --aggressive
> providing a large improvement. And it's a public repo, so I was able to
> grab a snapshot of the pre-packed state to experiment on and share.
> 
> The current packfile is ~246M. It was produced over time by pushes into
> the repository, which were then eventually grouped into a single pack by
> "git gc" (I'm not sure of the exact history, but this may even have been
> a set of "gc --auto" calls over time).
> 
> Here's a list of commands and the pack sizes they yield on the repo:
> 
>   1. `git repack -ad`: 246M
>   2. `git repack -ad -f`: 376M
>   3. `git repack -ad --window=250`: 246M
>   4. `git repack -ad -f --window=250`: 145M
> 
> The most interesting thing is (4): repacking with a larger window size
> yields a 100M (40%) space improvement. The other commands show that it
> is not that the current pack is simply bad; command (2) repacks from
> scratch and actually ends up with a worse pack. So the increased window
> size really is important.

Absolutely.  This doesn't surprises me.

> I haven't been able to figure out what it is about this dataset that
> makes the bigger window so much better. Certainly doing the same
> commands on git.git does not yield as impressive a speedup.

The default window size of 10 objects is really really small (yet if 
your objects are 150MB in size then it is probably too big, but I 
digress).  When doing an incremental repack, the window is also limited 
by the fact that we don't redelta those already packed objects.

Many things could explain the improvements with a larger window.  If a 
lot of files were renamed for example, the larger window would allow 
similar objects to still delta against each other, despite the fact that 
we pull them in the search window according to their corresponding file 
names.  With a smaller window this opportunity would be missed.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]