Skip to content

Commit

Permalink
pack-objects: don't use too many threads with few objects
Browse files Browse the repository at this point in the history
If there are few objects to deltify, they might be split amongst threads
so that there is simply no other objects left to delta against within
the same thread.  Let's use the same 2*window treshold as used for the
final load balancing to allow extra threads to be created.

This fixes the benign t5300 test failure.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Tested-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nicolas Pitre authored and Junio C Hamano committed Dec 14, 2008
1 parent 43cc2b4 commit bf87489
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,10 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
for (i = 0; i < delta_search_threads; i++) {
unsigned sub_size = list_size / (delta_search_threads - i);

/* don't use too small segments or no deltas will be found */
if (sub_size < 2*window && i+1 < delta_search_threads)
sub_size = 0;

p[i].window = window;
p[i].depth = depth;
p[i].processed = processed;
Expand Down

0 comments on commit bf87489

Please sign in to comment.