@matheusbsbs / matheus-bagliano / commits / c3b06a69ff
Fork 0

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>

Nicolas Pitre committed May 16, 2006 at 16:29 UTC c3b06a69ffc41b3ac3600628593dd0fdd3988607
1 file changed +5 -2
pack-objects.c
+5 -2
@@ -1037,9 +1037,12 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
1037 if (src_entry->depth >= max_depth)
1038 return 0;
1039
1040 - /* Now some size filtering euristics. */
1040 + /* Now some size filtering heuristics. */
1041 size = trg_entry->size;
1042 - max_size = (size/2 - 20) / (src_entry->depth + 1);
1042 + max_size = size/2 - 20;
1043 + max_size = max_size * (max_depth - src_entry->depth) / max_depth;
1044 + if (max_size == 0)
1045 + return 0;
1046 if (trg_entry->delta && trg_entry->delta_size <= max_size)
1047 max_size = trg_entry->delta_size-1;
1048 src_size = src_entry->size;