mirror of
https://github.com/git/git.git
synced 2024-10-31 22:37:54 +01:00
07e7dbf0db
This commit message is long and has lots of background and numbers. The summary is: the current default of 250 doesn't save much space, and costs CPU. It's not a good tradeoff. Read on for details. The "--aggressive" flag to git-gc does three things: 1. use "-f" to throw out existing deltas and recompute from scratch 2. use "--window=250" to look harder for deltas 3. use "--depth=250" to make longer delta chains Items (1) and (2) are good matches for an "aggressive" repack. They ask the repack to do more computation work in the hopes of getting a better pack. You pay the costs during the repack, and other operations see only the benefit. Item (3) is not so clear. Allowing longer chains means fewer restrictions on the deltas, which means potentially finding better ones and saving some space. But it also means that operations which access the deltas have to follow longer chains, which affects their performance. So it's a tradeoff, and it's not clear that the tradeoff is even a good one. The existing "250" numbers for "--aggressive" come originally from this thread: http://public-inbox.org/git/alpine.LFD.0.9999.0712060803430.13796@woody.linux-foundation.org/ where Linus says: So when I said "--depth=250 --window=250", I chose those numbers more as an example of extremely aggressive packing, and I'm not at all sure that the end result is necessarily wonderfully usable. It's going to save disk space (and network bandwidth - the delta's will be re-used for the network protocol too!), but there are definitely downsides too, and using long delta chains may simply not be worth it in practice. There are some numbers in that thread, but they're mostly focused on the improved window size, and measure the improvement from --depth=250 and --window=250 together. E.g.: http://public-inbox.org/git/9e4733910712062006l651571f3w7f76ce64c6650dff@mail.gmail.com/ talks about the improved run-time of "git-blame", which comes from the reduced pack size. But most of that reduction is coming from --window=250, whereas most of the extra costs come from --depth=250. There's a link in that thread showing that increasing the depth beyond 50 doesn't seem to help much with the size: https://vcscompare.blogspot.com/2008/06/git-repack-parameters.html but again, no discussion of the timing impact. In an earlier thread from Ted Ts'o which discussed setting the non-aggressive default (from 10 to 50): http://public-inbox.org/git/20070509134958.GA21489%40thunk.org/ we have more numbers, with the conclusion that going past 50 does not help size much, and hurts the speed of normal operations. So from that, we might guess that 50 is actually a sweet spot, even for aggressive, if we interpret aggressive to "spend time now to make a better pack". It is not clear that "--depth=250" is actually a better pack. It may be slightly _smaller_, but it carries a run-time penalty. Here are some more recent timings I did to verify that. They show three things: - the size of the resulting pack (so disk saved to store, bandwidth saved on clones/fetches) - the cost of "rev-list --objects --all", which shows the effect of the delta chains on trees (commits typically don't delta, and the command doesn't touch the blobs at all) - the cost of "log -Sfoo", which will additionally access each blob All cases were repacked with "git repack -adf --depth=$d --window=250" (so basically, what would happen if we tweaked the "gc --aggressive" default depth). The timings are all wall-clock best-of-3. The machine itself has plenty of RAM compared to the repositories (which is probably typical of most workstations these days), so we're really measuring CPU usage, as the whole thing will be in disk cache after the first run. The core.deltaBaseCacheLimit is at its default of 96MiB. It's possible that tweaking it would have some impact on the tests, as some of them (especially "log -S" on a large repo) are likely to overflow that. But bumping that carries a run-time memory cost, so for these tests, I focused on what we could do just with the on-disk pack tradeoffs. Each test is done for four depths: 250 (the current value), 50 (the current default that tested well previously), 100 (to show something on the larger side, which previous tests showed was not a good tradeoff), and 10 (the very old default, which previous tests showed was worse than 50). Here are the numbers for linux.git: depth | size | % | rev-list | % | log -Sfoo | % -------+-------+-------+----------+--------+-----------+------- 250 | 967MB | n/a | 48.159s | n/a | 378.088 | n/a 100 | 971MB | +0.4% | 41.471s | -13.9% | 342.060 | -9.5% 50 | 979MB | +1.2% | 37.778s | -21.6% | 311.040s | -17.7% 10 | 1.1GB | +6.6% | 32.518s | -32.5% | 279.890s | -25.9% and for git.git: depth | size | % | rev-list | % | log -Sfoo | % -------+-------+-------+----------+--------+-----------+------- 250 | 48MB | n/a | 2.215s | n/a | 20.922s | n/a 100 | 49MB | +0.5% | 2.140s | -3.4% | 17.736s | -15.2% 50 | 49MB | +1.7% | 2.099s | -5.2% | 15.418s | -26.3% 10 | 53MB | +9.3% | 2.001s | -9.7% | 12.677s | -39.4% You can see that that the CPU savings for regular operations improves as we decrease the depth. The savings are less for "rev-list" on a smaller repository than they are for blob-accessing operations, or even rev-list on a larger repository. This may mean that a larger delta cache would help (though setting core.deltaBaseCacheLimit by itself doesn't). But we can also see that the space savings are not that great as the depth goes higher. Saving 5-10% between 10 and 50 is probably worth the CPU tradeoff. Saving 1% to go from 50 to 100, or another 0.5% to go from 100 to 250 is probably not. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> |
||
---|---|---|
.. | ||
howto | ||
RelNotes | ||
technical | ||
.gitattributes | ||
.gitignore | ||
asciidoc.conf | ||
blame-options.txt | ||
build-docdep.perl | ||
cat-texi.perl | ||
cmd-list.perl | ||
CodingGuidelines | ||
config.txt | ||
date-formats.txt | ||
diff-config.txt | ||
diff-format.txt | ||
diff-generate-patch.txt | ||
diff-options.txt | ||
docbook-xsl.css | ||
docbook.xsl | ||
everyday.txto | ||
fetch-options.txt | ||
fix-texi.perl | ||
fmt-merge-msg-config.txt | ||
git-add.txt | ||
git-am.txt | ||
git-annotate.txt | ||
git-apply.txt | ||
git-archimport.txt | ||
git-archive.txt | ||
git-bisect-lk2009.txt | ||
git-bisect.txt | ||
git-blame.txt | ||
git-branch.txt | ||
git-bundle.txt | ||
git-cat-file.txt | ||
git-check-attr.txt | ||
git-check-ignore.txt | ||
git-check-mailmap.txt | ||
git-check-ref-format.txt | ||
git-checkout-index.txt | ||
git-checkout.txt | ||
git-cherry-pick.txt | ||
git-cherry.txt | ||
git-citool.txt | ||
git-clean.txt | ||
git-clone.txt | ||
git-column.txt | ||
git-commit-tree.txt | ||
git-commit.txt | ||
git-config.txt | ||
git-count-objects.txt | ||
git-credential-cache--daemon.txt | ||
git-credential-cache.txt | ||
git-credential-store.txt | ||
git-credential.txt | ||
git-cvsexportcommit.txt | ||
git-cvsimport.txt | ||
git-cvsserver.txt | ||
git-daemon.txt | ||
git-describe.txt | ||
git-diff-files.txt | ||
git-diff-index.txt | ||
git-diff-tree.txt | ||
git-diff.txt | ||
git-difftool.txt | ||
git-fast-export.txt | ||
git-fast-import.txt | ||
git-fetch-pack.txt | ||
git-fetch.txt | ||
git-filter-branch.txt | ||
git-fmt-merge-msg.txt | ||
git-for-each-ref.txt | ||
git-format-patch.txt | ||
git-fsck-objects.txt | ||
git-fsck.txt | ||
git-gc.txt | ||
git-get-tar-commit-id.txt | ||
git-grep.txt | ||
git-gui.txt | ||
git-hash-object.txt | ||
git-help.txt | ||
git-http-backend.txt | ||
git-http-fetch.txt | ||
git-http-push.txt | ||
git-imap-send.txt | ||
git-index-pack.txt | ||
git-init-db.txt | ||
git-init.txt | ||
git-instaweb.txt | ||
git-interpret-trailers.txt | ||
git-log.txt | ||
git-ls-files.txt | ||
git-ls-remote.txt | ||
git-ls-tree.txt | ||
git-mailinfo.txt | ||
git-mailsplit.txt | ||
git-merge-base.txt | ||
git-merge-file.txt | ||
git-merge-index.txt | ||
git-merge-one-file.txt | ||
git-merge-tree.txt | ||
git-merge.txt | ||
git-mergetool--lib.txt | ||
git-mergetool.txt | ||
git-mktag.txt | ||
git-mktree.txt | ||
git-mv.txt | ||
git-name-rev.txt | ||
git-notes.txt | ||
git-p4.txt | ||
git-pack-objects.txt | ||
git-pack-redundant.txt | ||
git-pack-refs.txt | ||
git-parse-remote.txt | ||
git-patch-id.txt | ||
git-prune-packed.txt | ||
git-prune.txt | ||
git-pull.txt | ||
git-push.txt | ||
git-quiltimport.txt | ||
git-read-tree.txt | ||
git-rebase.txt | ||
git-receive-pack.txt | ||
git-reflog.txt | ||
git-relink.txt | ||
git-remote-ext.txt | ||
git-remote-fd.txt | ||
git-remote-helpers.txto | ||
git-remote-testgit.txt | ||
git-remote.txt | ||
git-repack.txt | ||
git-replace.txt | ||
git-request-pull.txt | ||
git-rerere.txt | ||
git-reset.txt | ||
git-rev-list.txt | ||
git-rev-parse.txt | ||
git-revert.txt | ||
git-rm.txt | ||
git-send-email.txt | ||
git-send-pack.txt | ||
git-sh-i18n--envsubst.txt | ||
git-sh-i18n.txt | ||
git-sh-setup.txt | ||
git-shell.txt | ||
git-shortlog.txt | ||
git-show-branch.txt | ||
git-show-index.txt | ||
git-show-ref.txt | ||
git-show.txt | ||
git-stage.txt | ||
git-stash.txt | ||
git-status.txt | ||
git-stripspace.txt | ||
git-submodule.txt | ||
git-svn.txt | ||
git-symbolic-ref.txt | ||
git-tag.txt | ||
git-tools.txt | ||
git-unpack-file.txt | ||
git-unpack-objects.txt | ||
git-update-index.txt | ||
git-update-ref.txt | ||
git-update-server-info.txt | ||
git-upload-archive.txt | ||
git-upload-pack.txt | ||
git-var.txt | ||
git-verify-commit.txt | ||
git-verify-pack.txt | ||
git-verify-tag.txt | ||
git-web--browse.txt | ||
git-whatchanged.txt | ||
git-write-tree.txt | ||
git.txt | ||
gitattributes.txt | ||
gitcli.txt | ||
gitcore-tutorial.txt | ||
gitcredentials.txt | ||
gitcvs-migration.txt | ||
gitdiffcore.txt | ||
giteveryday.txt | ||
gitglossary.txt | ||
githooks.txt | ||
gitignore.txt | ||
gitk.txt | ||
gitmodules.txt | ||
gitnamespaces.txt | ||
gitremote-helpers.txt | ||
gitrepository-layout.txt | ||
gitrevisions.txt | ||
gittutorial-2.txt | ||
gittutorial.txt | ||
gitweb.conf.txt | ||
gitweb.txt | ||
gitworkflows.txt | ||
glossary-content.txt | ||
howto-index.sh | ||
i18n.txt | ||
install-doc-quick.sh | ||
install-webdoc.sh | ||
line-range-format.txt | ||
mailmap.txt | ||
Makefile | ||
manpage-1.72.xsl | ||
manpage-base-url.xsl.in | ||
manpage-base.xsl | ||
manpage-bold-literal.xsl | ||
manpage-normal.xsl | ||
manpage-quote-apos.xsl | ||
manpage-suppress-sp.xsl | ||
merge-config.txt | ||
merge-options.txt | ||
merge-strategies.txt | ||
pretty-formats.txt | ||
pretty-options.txt | ||
pull-fetch-param.txt | ||
rev-list-options.txt | ||
revisions.txt | ||
sequencer.txt | ||
SubmittingPatches | ||
urls-remotes.txt | ||
urls.txt | ||
user-manual.conf | ||
user-manual.txt |