@matheusbsbs / matheus-bagliano / commits / 9a8b6a0a9d
Fork 0

pack-objects: update size heuristucs.

We used to omit delta base candidates that is much bigger than the target, but delta size does not grow when we delete more, so that was not a very good heuristics. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Apr 27, 2006 at 19:31 UTC 9a8b6a0a9d4de3d9c1005b872b9b57a213d3e9f8
1 file changed +6 -6
pack-objects.c
+6 -6
@@ -1032,12 +1032,6 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
1032 max_depth -= cur_entry->delta_limit;
1033 }
1034
1035 - size = cur_entry->size;
1036 - oldsize = old_entry->size;
1037 - sizediff = oldsize > size ? oldsize - size : size - oldsize;
1038 -
1039 - if (size < 50)
1040 - return -1;
1035 if (old_entry->depth >= max_depth)
1036 return 0;
1037
@@ -1048,9 +1042,12 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
1042 * more space-efficient (deletes don't have to say _what_ they
1043 * delete).
1044 */
1045 + size = cur_entry->size;
1046 max_size = size / 2 - 20;
1047 if (cur_entry->delta)
1048 max_size = cur_entry->delta_size-1;
1049 + oldsize = old_entry->size;
1050 + sizediff = oldsize < size ? size - oldsize : 0;
1051 if (sizediff >= max_size)
1052 return 0;
1053 delta_buf = diff_delta(old->data, oldsize,
@@ -1109,6 +1106,9 @@ static void find_deltas(struct object_entry **list, int window, int depth)
1106 */
1107 continue;
1108
1109 + if (entry->size < 50)
1110 + continue;
1111 +
1112 free(n->data);
1113 n->entry = entry;
1114 n->data = read_sha1_file(entry->sha1, type, &size);