]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/pack-objects.c
apply delta depth bias to already deltified objects
authorNicolas Pitre <nico@cam.org>
Thu, 12 Jul 2007 18:33:21 +0000 (14:33 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Jul 2007 21:18:14 +0000 (14:18 -0700)
commitc83f032e09e49e5bc60686663f7c78d36f72cef4
treeec71539f8245c1000bb2dc6c5e4c07481b59b9ef
parentbaafd6e76522d4f20c9e1755537005f1cfd2f492
apply delta depth bias to already deltified objects

We already apply a bias on the initial delta attempt with max_size being
a function of the base object depth.  This has the effect of favoring
shallower deltas even if deeper deltas could be smaller, and therefore
creating a wider delta tree (see commits 4e8da195 and c3b06a69).

This principle should also be applied to all delta attempts for the same
object and not only the first attempt.  With this the criteria for the
best delta is not only its size but also its depth, so that a shallower
delta might be selected even if it is larger than a deeper one.  Even if
some deltas get larger, they allow for wider delta trees making the
depth limit less quickly reached and therefore better deltas can be
subsequently found, keeping the resulting pack size even smaller.
Runtime access to the pack should also benefit from shallower deltas.

Testing on different repositories showed slighter faster repacks,
smaller resulting packs, and a much nicer curve for delta depth
distribution with no more peak at the maximum depth level.
Improvements are even more significant with smaller depth limits.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c