All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Downing <bdowning@lavos.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Nicolas Pitre <nico@cam.org>,
	Brian Downing <bdowning@lavos.net>
Subject: [PATCH 1/6] Don't try to delta if target is much smaller than source
Date: Thu, 12 Jul 2007 07:55:47 -0500	[thread overview]
Message-ID: <11842449523154-git-send-email-bdowning@lavos.net> (raw)
In-Reply-To: <1184244952554-git-send-email-bdowning@lavos.net>

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>
---
 builtin-pack-objects.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 54b9d26..132ce96 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1342,6 +1342,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) {
-- 
1.5.2.GIT

  reply	other threads:[~2007-07-12 12:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-12 12:55 [PATCH 0/6] Pack window memory limit, take 2 Brian Downing
2007-07-12 12:55 ` Brian Downing [this message]
2007-07-12 12:55 ` [PATCH 2/6] Support fetching the memory usage of a delta index Brian Downing
2007-07-12 12:55 ` [PATCH 3/6] Add functions for parsing integers with size suffixes Brian Downing
2007-07-12 13:07   ` Johannes Schindelin
2007-07-12 13:32     ` [PATCH] " Brian Downing
2007-07-12 12:55 ` [PATCH 4/6] Add pack-objects window memory usage limit Brian Downing
2007-07-12 13:04   ` Brian Downing
2007-07-12 13:07     ` [PATCH] " Brian Downing
2007-07-12 12:55 ` [PATCH 5/6] Add --window-memory option to git-repack Brian Downing
2007-07-12 12:55 ` [PATCH 6/6] Add documentation for --window-memory, pack.windowMemory Brian Downing
2007-07-12 15:46 ` [PATCH 0/6] Pack window memory limit, take 2 Nicolas Pitre
2007-07-13 18:23 ` Junio C Hamano

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=11842449523154-git-send-email-bdowning@lavos.net \
    --to=bdowning@lavos.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nico@cam.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.