From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brian Downing <bdowning@lavos.net>, git@vger.kernel.org
Subject: Re: Preferring shallower deltas on repack
Date: Mon, 09 Jul 2007 11:58:06 -0400 (EDT) [thread overview]
Message-ID: <alpine.LFD.0.999.0707090954550.26459@xanadu.home> (raw)
In-Reply-To: <7v1wfixhvk.fsf@assigned-by-dhcp.cox.net>
On Sun, 8 Jul 2007, Junio C Hamano wrote:
> It would become worrysome (*BUT* infinitely more interesting)
> once you start talking about a tradeoff between slightly larger
> delta and much shorter delta. Such a tradeoff, if done right,
> would make a lot of sense, but I do not offhand think of a way
> to strike a proper balance between them efficiently.
We already do something similar to that with max_size being a function
of the delta depth. This already has the effect of favoring shalower
deltas even if deeper deltas could be smaller, and therefore creating a
wider delta tree (see commits 4e8da195 and c3b06a69).
Maybe this max_size curve could be modified a bit to increase the bias
towards shallow deltas even in the case where a delta was already found
instead of the current constant flat curve.
[...]
OK here it is. And results on the GIT repo and another patalogical test
repo I keep around are actually really nice! Not only the pack itself
is a bit smaller, but the delta depth distribution as shown by
git-verify-pack -v is much nicer with the bulk of deltas in the low
depth end of the spectrum and no more peak at the max depth level.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 54b9d26..1eb86ed 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1332,12 +1332,14 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
/* Now some size filtering heuristics. */
trg_size = trg_entry->size;
- max_size = trg_size/2 - 20;
+ if (!trg_entry->delta)
+ max_size = trg_size/2 - 20;
+ else
+ max_size = trg_entry->delta_size * max_depth /
+ (max_depth - trg_entry->depth + 1);
max_size = max_size * (max_depth - src_entry->depth) / max_depth;
if (max_size == 0)
return 0;
- if (trg_entry->delta && trg_entry->delta_size <= max_size)
- max_size = trg_entry->delta_size;
src_size = src_entry->size;
sizediff = src_size < trg_size ? trg_size - src_size : 0;
if (sizediff >= max_size)
next prev parent reply other threads:[~2007-07-09 15:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-09 4:43 Preferring shallower deltas on repack Brian Downing
2007-07-09 4:45 ` [PATCH] pack-objects: Prefer shallower deltas if the size is equal Brian Downing
2007-07-09 5:31 ` Preferring shallower deltas on repack Junio C Hamano
2007-07-09 5:43 ` Junio C Hamano
2007-07-09 6:52 ` Brian Downing
2007-07-09 7:27 ` Junio C Hamano
2007-07-09 7:36 ` Brian Downing
2007-07-09 15:58 ` Nicolas Pitre [this message]
2007-07-09 16:39 ` Junio C Hamano
2007-07-09 18:53 ` Brian Downing
2007-07-09 19:13 ` Nicolas Pitre
2007-07-09 19:24 ` Brian Downing
2007-07-09 19:49 ` Brian Downing
2007-07-09 20:22 ` Nicolas Pitre
2007-07-09 20:23 ` Brian Downing
2007-07-09 19:30 ` [PATCH] Shoddy pack information tool Brian Downing
2007-07-11 21:55 ` Junio C Hamano
2007-07-12 3:02 ` [PATCH] Pack " Brian Downing
2007-07-09 5:41 ` Preferring shallower deltas on repack Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.0.999.0707090954550.26459@xanadu.home \
--to=nico@cam.org \
--cc=bdowning@lavos.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).