]> git.ipfire.org Git - thirdparty/git.git/commit - pack-bitmap.c
pack-objects: improve partial packfile reuse
authorJeff King <peff@peff.net>
Wed, 18 Dec 2019 11:25:45 +0000 (12:25 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Jan 2020 18:51:50 +0000 (10:51 -0800)
commitbb514de356cfcfd314f7ac7ae1acfeede3fa4b1f
treedc222189645405ee1eab03d9493a553bf6f33b34
parentff483026a9ab29d01b6142ea3b44f4ffd8acb8c2
pack-objects: improve partial packfile reuse

The old code to reuse deltas from an existing packfile
just tried to dump a whole segment of the pack verbatim.
That's faster than the traditional way of actually adding
objects to the packing list, but it didn't kick in very
often. This new code is really going for a middle ground:
do _some_ per-object work, but way less than we'd
traditionally do.

The general strategy of the new code is to make a bitmap
of objects from the packfile we'll include, and then
iterate over it, writing out each object exactly as it is
in our on-disk pack, but _not_ adding it to our packlist
(which costs memory, and increases the search space for
deltas).

One complication is that if we're omitting some objects,
we can't set a delta against a base that we're not
sending. So we have to check each object in
try_partial_reuse() to make sure we have its delta.

About performance, in the worst case we might have
interleaved objects that we are sending or not sending,
and we'd have as many chunks as objects. But in practice
we send big chunks.

For instance, packing torvalds/linux on GitHub servers
now reused 6.5M objects, but only needed ~50k chunks.

Helped-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
pack-bitmap.c
pack-bitmap.h