Skip to content

Commit

Permalink
p5302: disable thread-count parameter tests by default
Browse files Browse the repository at this point in the history
The primary function of the perf suite is to detect regressions (or
improvements) between versions of Git. The only numbers we show a direct
comparison for are timings between the same test run on two different
versions.

However, it can sometimes be used to collect other information.  For
instance, p5302 runs the same index-pack operation with different thread
counts. The output doesn't directly compare these, but anybody
interested in working on index-pack can manually compare the results.

For a normal regression run of the full perf-suite, though, this incurs
a significant cost to generate numbers nobody will actually look at;
about 25% of the total time of the test suite is spent in p5302. And the
low-thread-count runs are the most expensive part of it, since they're
(unsurprisingly) not using as many threads.

Let's skip these tests by default, but make it possible for people
working on index-pack to still run them by setting an environment
variable. Rather than make this specific to p5302, let's introduce a
generic mechanism. This makes it possible to run the full suite with
every possible test if somebody really wants to burn some CPU.

Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
peff authored and gitster committed Aug 21, 2020
1 parent 47ae905 commit 4727425
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 9 additions & 0 deletions t/perf/README
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
10 changes: 5 additions & 5 deletions t/perf/p5302-pack-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ test_expect_success 'repack' '
export PACK
'

test_perf 'index-pack 0 threads' '
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 ' '
test_perf PERF_EXTRA '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' '
test_perf PERF_EXTRA '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' '
test_perf PERF_EXTRA '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' '
test_perf PERF_EXTRA 'index-pack 8 threads' '
rm -rf repo.git &&
git init --bare repo.git &&
GIT_DIR=repo.git git index-pack --threads=8 --stdin < $PACK
Expand Down
2 changes: 2 additions & 0 deletions t/perf/perf-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,5 @@ test_at_end_hook_ () {
test_export () {
export "$@"
}

test_lazy_prereq PERF_EXTRA 'test_bool_env GIT_PERF_EXTRA false'

0 comments on commit 4727425

Please sign in to comment.