git-gc "--aggressive" somewhat broken
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jul 6, 2007, 20:19 UTC
- Message-ID
- <alpine.LFD.0.999.0707061310390.8278@woody.linux-foundation.org>
This flag seems misdesigned as-is.
It makes the window bigger (good, and aggressive), but it also enabled "-f".
Which sometimes causes _worse_ packing.
In particular, there's a gcc import at
git://git.infradead.org/toolchain/gcc.git
which apparently packs down quite nicely to a 450MB pack, but when it gets repacked "aggressively", it blows up to 1.4GB. The reason? That pack was generated using --depth=100 --window=100 (I think).
So under certain circumstances, "--aggressive" is anything _but_ aggressive, and actually causes much worse packing.
If we want to be really aggressive, we migth decide to pass a new flag to pack-objects that does something closer to what "aggressive" was meant to do: it would use existing delta's if they exist, but _despite_ existing it could look if there are even better choices.
So right now we have:
- default behaviour:
always re-use existing deltas, don't look at alternatives at all.
This is optimal for CPU/memory/IO usage, and is generally a good idea
- "-f" (and as a result, the current bad "git gc --aggressive"):
never re-use existing deltas, always look for new ones.
This is good if you have reason to believe that the old choices are bad, or you need to force re-generation of deltas (because you want to force a new pack-file format, for example)
and the missing piece might be
- "git pack-objects --aggressive":
re-use existing deltas _and_ look for even better ones.
This is good if all you're looking for is better packing.
Hmm?
Linus