summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-12-29 01:21:33 -0800
committerJunio C Hamano <gitster@pobox.com>2008-12-29 01:21:33 -0800
commit78d4096d573ae796f72e5b05bf1c332f038e54dd (patch)
treeccf6e1a04397f44f55497a51466336582473f3c8
parent373654ee0f568fdeab891c621d6a1ac6b0c15d3a (diff)
parent1415be8f0f86c6d2aa2cb014c3cc32dd92e9c43a (diff)
downloadgit-78d4096d573ae796f72e5b05bf1c332f038e54dd.tar.gz
Merge branch 'np/auto-thread'
* np/auto-thread: Force t5302 to use a single thread pack-objects: don't use too many threads with few objects autodetect number of CPUs by default when using threads
-rw-r--r--builtin-pack-objects.c9
-rwxr-xr-xt/t5302-pack-index.sh1
2 files changed, 9 insertions, 1 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index cedef52fd3..e8515348be 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -78,7 +78,7 @@ static int progress = 1;
static int window = 10;
static uint32_t pack_size_limit, pack_size_limit_cfg;
static int depth = 50;
-static int delta_search_threads = 1;
+static int delta_search_threads;
static int pack_to_stdout;
static int num_preferred_base;
static struct progress *progress_state;
@@ -1612,11 +1612,18 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
find_deltas(list, &list_size, window, depth, processed);
return;
}
+ if (progress > pack_to_stdout)
+ fprintf(stderr, "Delta compression using %d threads.\n",
+ delta_search_threads);
/* Partition the work amongst work threads. */
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;
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 884e24253a..e6f70d474f 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -10,6 +10,7 @@ test_expect_success \
'setup' \
'rm -rf .git
git init &&
+ git config pack.threads 1 &&
i=1 &&
while test $i -le 100
do