2012-05-06 12:31:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description="Tests index-pack performance"
|
|
|
|
|
|
|
|
. ./perf-lib.sh
|
|
|
|
|
|
|
|
test_perf_large_repo
|
|
|
|
|
|
|
|
test_expect_success 'repack' '
|
|
|
|
git repack -ad &&
|
2014-04-23 13:44:06 +00:00
|
|
|
PACK=$(ls .git/objects/pack/*.pack | head -n1) &&
|
2012-05-06 12:31:55 +00:00
|
|
|
test -f "$PACK" &&
|
|
|
|
export PACK
|
|
|
|
'
|
|
|
|
|
p5302: count up to online-cpus for thread tests
When PERF_EXTRA is enabled, p5302 checks the performance of index-pack
with various numbers of threads. This can be useful for deciding what
the default should be (which is currently capped at 3 threads based on
the results of this script).
However, we only go up to 8 threads, and modern machines may have more.
Let's get the number of CPUs from test-tool, and test various numbers of
threads between one and that maximum.
Note that the current tests aren't all identical, as we have to set
GIT_FORCE_THREADS for the --threads=1 test (which measures the overhead
of starting a single worker thread versus the "0" case of using the main
thread). To keep the loop simple, we'll keep the "0" case out of it, and
set GIT_FORCE_THREADS=1 for all of the other cases (it's a noop for all
but the "1" case, since numbers higher than 1 would always need
threads).
Note also that we could skip running "test-tool" if PERF_EXTRA isn't
set. However, there's some small value in knowing the number of threads,
so that we can mark each test as skipped in the output.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-21 17:54:51 +00:00
|
|
|
# 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
|
tests: fix broken &&-chains in compound statements
The top-level &&-chain checker built into t/test-lib.sh causes tests to
magically exit with code 117 if the &&-chain is broken. However, it has
the shortcoming that the magic does not work within `{...}` groups,
`(...)` subshells, `$(...)` substitutions, or within bodies of compound
statements, such as `if`, `for`, `while`, `case`, etc. `chainlint.sed`
partly fills in the gap by catching broken &&-chains in `(...)`
subshells, but bugs can still lurk behind broken &&-chains in the other
cases.
Fix broken &&-chains in compound statements in order to reduce the
number of possible lurking bugs.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-09 05:11:06 +00:00
|
|
|
threads="$t $threads" &&
|
2021-12-09 05:11:12 +00:00
|
|
|
t=$((t / 2)) || return 1
|
p5302: count up to online-cpus for thread tests
When PERF_EXTRA is enabled, p5302 checks the performance of index-pack
with various numbers of threads. This can be useful for deciding what
the default should be (which is currently capped at 3 threads based on
the results of this script).
However, we only go up to 8 threads, and modern machines may have more.
Let's get the number of CPUs from test-tool, and test various numbers of
threads between one and that maximum.
Note that the current tests aren't all identical, as we have to set
GIT_FORCE_THREADS for the --threads=1 test (which measures the overhead
of starting a single worker thread versus the "0" case of using the main
thread). To keep the loop simple, we'll keep the "0" case out of it, and
set GIT_FORCE_THREADS=1 for all of the other cases (it's a noop for all
but the "1" case, since numbers higher than 1 would always need
threads).
Note also that we could skip running "test-tool" if PERF_EXTRA isn't
set. However, there's some small value in knowing the number of threads,
so that we can mark each test as skipped in the output.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-21 17:54:51 +00:00
|
|
|
done
|
2012-05-06 12:31:55 +00:00
|
|
|
'
|
|
|
|
|
2022-04-05 05:20:17 +00:00
|
|
|
test_perf 'index-pack 0 threads' --prereq PERF_EXTRA \
|
|
|
|
--setup 'rm -rf repo.git && git init --bare repo.git' '
|
p5302: count up to online-cpus for thread tests
When PERF_EXTRA is enabled, p5302 checks the performance of index-pack
with various numbers of threads. This can be useful for deciding what
the default should be (which is currently capped at 3 threads based on
the results of this script).
However, we only go up to 8 threads, and modern machines may have more.
Let's get the number of CPUs from test-tool, and test various numbers of
threads between one and that maximum.
Note that the current tests aren't all identical, as we have to set
GIT_FORCE_THREADS for the --threads=1 test (which measures the overhead
of starting a single worker thread versus the "0" case of using the main
thread). To keep the loop simple, we'll keep the "0" case out of it, and
set GIT_FORCE_THREADS=1 for all of the other cases (it's a noop for all
but the "1" case, since numbers higher than 1 would always need
threads).
Note also that we could skip running "test-tool" if PERF_EXTRA isn't
set. However, there's some small value in knowing the number of threads,
so that we can mark each test as skipped in the output.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-21 17:54:51 +00:00
|
|
|
GIT_DIR=repo.git git index-pack --threads=1 --stdin < $PACK
|
2012-05-06 12:31:55 +00:00
|
|
|
'
|
|
|
|
|
p5302: count up to online-cpus for thread tests
When PERF_EXTRA is enabled, p5302 checks the performance of index-pack
with various numbers of threads. This can be useful for deciding what
the default should be (which is currently capped at 3 threads based on
the results of this script).
However, we only go up to 8 threads, and modern machines may have more.
Let's get the number of CPUs from test-tool, and test various numbers of
threads between one and that maximum.
Note that the current tests aren't all identical, as we have to set
GIT_FORCE_THREADS for the --threads=1 test (which measures the overhead
of starting a single worker thread versus the "0" case of using the main
thread). To keep the loop simple, we'll keep the "0" case out of it, and
set GIT_FORCE_THREADS=1 for all of the other cases (it's a noop for all
but the "1" case, since numbers higher than 1 would always need
threads).
Note also that we could skip running "test-tool" if PERF_EXTRA isn't
set. However, there's some small value in knowing the number of threads,
so that we can mark each test as skipped in the output.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-21 17:54:51 +00:00
|
|
|
for t in $threads
|
|
|
|
do
|
|
|
|
THREADS=$t
|
|
|
|
export THREADS
|
2022-04-05 05:20:17 +00:00
|
|
|
test_perf "index-pack $t threads" --prereq PERF_EXTRA \
|
|
|
|
--setup 'rm -rf repo.git && git init --bare repo.git' '
|
p5302: count up to online-cpus for thread tests
When PERF_EXTRA is enabled, p5302 checks the performance of index-pack
with various numbers of threads. This can be useful for deciding what
the default should be (which is currently capped at 3 threads based on
the results of this script).
However, we only go up to 8 threads, and modern machines may have more.
Let's get the number of CPUs from test-tool, and test various numbers of
threads between one and that maximum.
Note that the current tests aren't all identical, as we have to set
GIT_FORCE_THREADS for the --threads=1 test (which measures the overhead
of starting a single worker thread versus the "0" case of using the main
thread). To keep the loop simple, we'll keep the "0" case out of it, and
set GIT_FORCE_THREADS=1 for all of the other cases (it's a noop for all
but the "1" case, since numbers higher than 1 would always need
threads).
Note also that we could skip running "test-tool" if PERF_EXTRA isn't
set. However, there's some small value in knowing the number of threads,
so that we can mark each test as skipped in the output.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-21 17:54:51 +00:00
|
|
|
GIT_DIR=repo.git GIT_FORCE_THREADS=1 \
|
|
|
|
git index-pack --threads=$THREADS --stdin <$PACK
|
|
|
|
'
|
|
|
|
done
|
2012-05-06 12:31:55 +00:00
|
|
|
|
2022-04-05 05:20:17 +00:00
|
|
|
test_perf 'index-pack default number of threads' \
|
|
|
|
--setup 'rm -rf repo.git && git init --bare repo.git' '
|
2019-04-22 21:19:52 +00:00
|
|
|
GIT_DIR=repo.git git index-pack --stdin < $PACK
|
2012-05-06 12:31:55 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|