]> git.ipfire.org Git - thirdparty/git.git/commit - pack.h
pack-objects: reuse data from existing packs.
authorJunio C Hamano <junkio@cox.net>
Thu, 16 Feb 2006 01:34:29 +0000 (17:34 -0800)
committerJunio C Hamano <junkio@cox.net>
Fri, 17 Feb 2006 10:11:38 +0000 (02:11 -0800)
commita49dd05fd047f504a74fb053bb8ddbb9e4bd152b
treee850ef16ae77b243cad03615b98526dd39ab1b23
parent8cb711c8a5f98c1556b320114d7cc65e498ee2ae
pack-objects: reuse data from existing packs.

When generating a new pack, notice if we have already needed
objects in existing packs.  If an object is stored deltified,
and its base object is also what we are going to pack, then
reuse the existing deltified representation unconditionally,
bypassing all the expensive find_deltas() and try_deltas()
calls.

Also, notice if what we are going to write out exactly match
what is already in an existing pack (either deltified or just
compressed).  In such a case, we can just copy it instead of
going through the usual uncompressing & recompressing cycle.

Without this patch, in linux-2.6 repository with about 1500
loose objects and a single mega pack:

    $ git-rev-list --objects v2.6.16-rc3 >RL
    $ wc -l RL
    184141 RL
    $ time git-pack-objects p <RL
    Generating pack...
    Done counting 184141 objects.
    Packing 184141 objects....................
    a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2

    real    12m4.323s
    user    11m2.560s
    sys     0m55.950s

With this patch, the same input:

    $ time ../git.junio/git-pack-objects q <RL
    Generating pack...
    Done counting 184141 objects.
    Packing 184141 objects.....................
    a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2
    Total 184141, written 184141, reused 182441

    real    1m2.608s
    user    0m55.090s
    sys     0m1.830s

Signed-off-by: Junio C Hamano <junkio@cox.net>
pack-objects.c
pack.h
sha1_file.c