Skip to content

Commit

Permalink
Don't try to delta if target is much smaller than source
Browse files Browse the repository at this point in the history
Add a new try_delta heuristic.  Don't bother trying to make a delta if
the target object size is much smaller (currently 1/32) than the source,
as it's very likely not going to get a match.  Even if it does, you will
have to read at least 32x the size of the new file to reassemble it,
which isn't such a good deal.  This leads to a considerable performance
improvement when deltifying a mix of small and large files with a very
large window, because you don't have to wait for the large files to
percolate out of the window before things start going fast again.

Signed-off-by: Brian Downing <bdowning@lavos.net>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
bdowning authored and gitster committed Jul 12, 2007
1 parent b492bbd commit a1dab41
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-pack-objects.c
Expand Up @@ -1348,6 +1348,8 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
sizediff = src_size < trg_size ? trg_size - src_size : 0;
if (sizediff >= max_size)
return 0;
if (trg_size < src_size / 32)
return 0;

/* Load data if not already done */
if (!trg->data) {
Expand Down

0 comments on commit a1dab41

Please sign in to comment.