Merge branch 'jk/index-pack-w-more-threads'
Long ago, we decided to use 3 threads by default when running the index-pack task in parallel, which has been adjusted a bit upwards. * jk/index-pack-w-more-threads: index-pack: adjust default threading cap p5302: count up to online-cpus for thread tests p5302: disable thread-count parameter tests by default
This commit is contained in:
commit
53015c9dd4
@ -1798,9 +1798,22 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
|
||||
|
||||
if (HAVE_THREADS && !nr_threads) {
|
||||
nr_threads = online_cpus();
|
||||
/* An experiment showed that more threads does not mean faster */
|
||||
if (nr_threads > 3)
|
||||
nr_threads = 3;
|
||||
/*
|
||||
* Experiments show that going above 20 threads doesn't help,
|
||||
* no matter how many cores you have. Below that, we tend to
|
||||
* max at half the number of online_cpus(), presumably because
|
||||
* half of those are hyperthreads rather than full cores. We'll
|
||||
* never reduce the level below "3", though, to match a
|
||||
* historical value that nobody complained about.
|
||||
*/
|
||||
if (nr_threads < 4)
|
||||
; /* too few cores to consider capping */
|
||||
else if (nr_threads < 6)
|
||||
nr_threads = 3; /* historic cap */
|
||||
else if (nr_threads < 40)
|
||||
nr_threads /= 2;
|
||||
else
|
||||
nr_threads = 20; /* hard cap */
|
||||
}
|
||||
|
||||
curr_pack = open_pack_file(pack_name);
|
||||
|
@ -84,6 +84,15 @@ You can set the following variables (also in your config.mak):
|
||||
probably be about linux.git size for optimal results.
|
||||
Both default to the git.git you are running from.
|
||||
|
||||
GIT_PERF_EXTRA
|
||||
Boolean to enable additional tests. Most test scripts are
|
||||
written to detect regressions between two versions of Git, and
|
||||
the output will compare timings for individual tests between
|
||||
those versions. Some scripts have additional tests which are not
|
||||
run by default, that show patterns within a single version of
|
||||
Git (e.g., performance of index-pack as the number of threads
|
||||
changes). These can be enabled with GIT_PERF_EXTRA.
|
||||
|
||||
You can also pass the options taken by ordinary git tests; the most
|
||||
useful one is:
|
||||
|
||||
|
@ -13,35 +13,36 @@ test_expect_success 'repack' '
|
||||
export PACK
|
||||
'
|
||||
|
||||
test_perf 'index-pack 0 threads' '
|
||||
# Rather than counting up and doubling each time, count down from the endpoint,
|
||||
# halving each time. That ensures that our final test uses as many threads as
|
||||
# CPUs, even if it isn't a power of 2.
|
||||
test_expect_success 'set up thread-counting tests' '
|
||||
t=$(test-tool online-cpus) &&
|
||||
threads= &&
|
||||
while test $t -gt 0
|
||||
do
|
||||
threads="$t $threads"
|
||||
t=$((t / 2))
|
||||
done
|
||||
'
|
||||
|
||||
test_perf PERF_EXTRA 'index-pack 0 threads' '
|
||||
rm -rf repo.git &&
|
||||
git init --bare repo.git &&
|
||||
GIT_DIR=repo.git git index-pack --threads=1 --stdin < $PACK
|
||||
'
|
||||
|
||||
test_perf 'index-pack 1 thread ' '
|
||||
rm -rf repo.git &&
|
||||
git init --bare repo.git &&
|
||||
GIT_DIR=repo.git GIT_FORCE_THREADS=1 git index-pack --threads=1 --stdin < $PACK
|
||||
'
|
||||
|
||||
test_perf 'index-pack 2 threads' '
|
||||
rm -rf repo.git &&
|
||||
git init --bare repo.git &&
|
||||
GIT_DIR=repo.git git index-pack --threads=2 --stdin < $PACK
|
||||
'
|
||||
|
||||
test_perf 'index-pack 4 threads' '
|
||||
rm -rf repo.git &&
|
||||
git init --bare repo.git &&
|
||||
GIT_DIR=repo.git git index-pack --threads=4 --stdin < $PACK
|
||||
'
|
||||
|
||||
test_perf 'index-pack 8 threads' '
|
||||
rm -rf repo.git &&
|
||||
git init --bare repo.git &&
|
||||
GIT_DIR=repo.git git index-pack --threads=8 --stdin < $PACK
|
||||
'
|
||||
for t in $threads
|
||||
do
|
||||
THREADS=$t
|
||||
export THREADS
|
||||
test_perf PERF_EXTRA "index-pack $t threads" '
|
||||
rm -rf repo.git &&
|
||||
git init --bare repo.git &&
|
||||
GIT_DIR=repo.git GIT_FORCE_THREADS=1 \
|
||||
git index-pack --threads=$THREADS --stdin <$PACK
|
||||
'
|
||||
done
|
||||
|
||||
test_perf 'index-pack default number of threads' '
|
||||
rm -rf repo.git &&
|
||||
|
@ -245,3 +245,5 @@ test_at_end_hook_ () {
|
||||
test_export () {
|
||||
export "$@"
|
||||
}
|
||||
|
||||
test_lazy_prereq PERF_EXTRA 'test_bool_env GIT_PERF_EXTRA false'
|
||||
|
Loading…
Reference in New Issue
Block a user