git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/5] Don't try to delta if target is much smaller than source

From
Brian Downing <bdowning@lavos.net>
Date
Jul 12, 2007, 03:14 UTC
Message-ID
<11842100581148-git-send-email-bdowning@lavos.net>
In-Reply-To
<11842100581060-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
Previous: Brian DowningNext: Brian Downing
Message 2 of 10 in “Memory-limited pack-object window support”
  1. 0/5 Memory-limited pack-object window supportBrian Downing, Jul 12, 2007
  2. 1/5 Don't try to delta if target is much smaller than sourceBrian Downing, Jul 12, 2007
  3. 2/5 Support fetching the memory usage of a delta indexBrian Downing, Jul 12, 2007
  4. 3/5 Add pack-objects window memory usage limitBrian Downing, Jul 12, 2007
  5. Nicolas PitreJul 12, 2007
  6. Brian DowningJul 12, 2007
  7. 4/5 Add --window-bytes option to git-repackBrian Downing, Jul 12, 2007
  8. 5/5 Add documentation for --window-bytes, pack.windowBytesBrian Downing, Jul 12, 2007
  9. Nicolas PitreJul 12, 2007
  10. Nicolas PitreJul 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.