summaryrefslogtreecommitdiff
path: root/pack-objects.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2006-05-16 20:29:14 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-05-16 20:35:46 (GMT)
commitc3b06a69ffc41b3ac3600628593dd0fdd3988607 (patch)
tree562b4fa4eb89a82fc5c50ef60f70ee54f0788d70 /pack-objects.c
parentff45715ce50b80ab16ee0d0dc7fff0c47a51959a (diff)
downloadgit-c3b06a69ffc41b3ac3600628593dd0fdd3988607.zip
git-c3b06a69ffc41b3ac3600628593dd0fdd3988607.tar.gz
git-c3b06a69ffc41b3ac3600628593dd0fdd3988607.tar.bz2
improve depth heuristic for maximum delta size
This provides a linear decrement on the penalty related to delta depth instead of being an 1/x function. With this another 5% reduction is observed on packs for both the GIT repo and the Linux kernel repo, as well as fixing a pack size regression in another sample repo I have. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'pack-objects.c')
-rw-r--r--pack-objects.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pack-objects.c b/pack-objects.c
index b430b02..3375179 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1037,9 +1037,12 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
if (src_entry->depth >= max_depth)
return 0;
- /* Now some size filtering euristics. */
+ /* Now some size filtering heuristics. */
size = trg_entry->size;
- max_size = (size/2 - 20) / (src_entry->depth + 1);
+ max_size = size/2 - 20;
+ 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-1;
src_size = src_entry->size;