summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
Diffstat (limited to 't/perf')
-rw-r--r--t/perf/Makefile5
-rw-r--r--t/perf/README11
-rwxr-xr-xt/perf/p1400-update-ref.sh13
-rwxr-xr-xt/perf/p3400-rebase.sh6
-rwxr-xr-xt/perf/p5302-pack-index.sh47
-rwxr-xr-xt/perf/p5303-many-packs.sh4
-rwxr-xr-xt/perf/p7519-fsmonitor.sh156
-rw-r--r--t/perf/perf-lib.sh2
8 files changed, 159 insertions, 85 deletions
diff --git a/t/perf/Makefile b/t/perf/Makefile
index 8c47155a7c..fcb0e8865e 100644
--- a/t/perf/Makefile
+++ b/t/perf/Makefile
@@ -1,7 +1,7 @@
-include ../../config.mak
export GIT_TEST_OPTIONS
-all: perf
+all: test-lint perf
perf: pre-clean
./run
@@ -12,4 +12,7 @@ pre-clean:
clean:
rm -rf build "trash directory".* test-results
+test-lint:
+ $(MAKE) -C .. test-lint
+
.PHONY: all perf pre-clean clean
diff --git a/t/perf/README b/t/perf/README
index c7b70e2d28..fb9127a66f 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -28,6 +28,8 @@ the tests on the current git repository.
7810.3: grep --cached, cheap regex 3.07(3.02+0.25)
7810.4: grep --cached, expensive regex 9.39(30.57+0.24)
+Output format is in seconds "Elapsed(User + System)"
+
You can compare multiple repositories and even git revisions with the
'run' script:
@@ -84,6 +86,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:
diff --git a/t/perf/p1400-update-ref.sh b/t/perf/p1400-update-ref.sh
index d275a81248..ce5ac3ed85 100755
--- a/t/perf/p1400-update-ref.sh
+++ b/t/perf/p1400-update-ref.sh
@@ -7,11 +7,13 @@ test_description="Tests performance of update-ref"
test_perf_fresh_repo
test_expect_success "setup" '
+ git init --bare target-repo.git &&
test_commit PRE &&
test_commit POST &&
printf "create refs/heads/%d PRE\n" $(test_seq 1000) >create &&
printf "update refs/heads/%d POST PRE\n" $(test_seq 1000) >update &&
- printf "delete refs/heads/%d POST\n" $(test_seq 1000) >delete
+ printf "delete refs/heads/%d POST\n" $(test_seq 1000) >delete &&
+ git update-ref --stdin <create
'
test_perf "update-ref" '
@@ -24,9 +26,14 @@ test_perf "update-ref" '
'
test_perf "update-ref --stdin" '
- git update-ref --stdin <create &&
git update-ref --stdin <update &&
- git update-ref --stdin <delete
+ git update-ref --stdin <delete &&
+ git update-ref --stdin <create
+'
+
+test_perf "nonatomic push" '
+ git push ./target-repo.git $(test_seq 1000) &&
+ git push --delete ./target-repo.git $(test_seq 1000)
'
test_done
diff --git a/t/perf/p3400-rebase.sh b/t/perf/p3400-rebase.sh
index d202aaed06..7a0bb29448 100755
--- a/t/perf/p3400-rebase.sh
+++ b/t/perf/p3400-rebase.sh
@@ -9,16 +9,16 @@ test_expect_success 'setup rebasing on top of a lot of changes' '
git checkout -f -B base &&
git checkout -B to-rebase &&
git checkout -B upstream &&
- for i in $(seq 100)
+ for i in $(test_seq 100)
do
# simulate huge diffs
echo change$i >unrelated-file$i &&
- seq 1000 >>unrelated-file$i &&
+ test_seq 1000 >>unrelated-file$i &&
git add unrelated-file$i &&
test_tick &&
git commit -m commit$i unrelated-file$i &&
echo change$i >unrelated-file$i &&
- seq 1000 | tac >>unrelated-file$i &&
+ test_seq 1000 | tac >>unrelated-file$i &&
git add unrelated-file$i &&
test_tick &&
git commit -m commit$i-reverse unrelated-file$i ||
diff --git a/t/perf/p5302-pack-index.sh b/t/perf/p5302-pack-index.sh
index a9b3e112d9..228593d9ad 100755
--- a/t/perf/p5302-pack-index.sh
+++ b/t/perf/p5302-pack-index.sh
@@ -13,35 +13,36 @@ test_expect_success 'repack' '
export PACK
'
-test_perf '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
+# 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 'index-pack 2 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=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
+ GIT_DIR=repo.git git index-pack --threads=1 --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 &&
diff --git a/t/perf/p5303-many-packs.sh b/t/perf/p5303-many-packs.sh
index 7ee791669a..f4c2ab0584 100755
--- a/t/perf/p5303-many-packs.sh
+++ b/t/perf/p5303-many-packs.sh
@@ -73,6 +73,10 @@ do
git rev-list --objects --all >/dev/null
'
+ test_perf "abbrev-commit ($nr_packs)" '
+ git rev-list --abbrev-commit HEAD >/dev/null
+ '
+
# This simulates the interesting part of the repack, which is the
# actual pack generation, without smudging the on-disk setup
# between trials.
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index def7ecdbc7..163a13bea3 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -22,7 +22,9 @@ test_description="Test core.fsmonitor"
#
# GIT_PERF_7519_UNTRACKED_CACHE: used to configure core.untrackedCache
# GIT_PERF_7519_SPLIT_INDEX: used to configure core.splitIndex
-# GIT_PERF_7519_FSMONITOR: used to configure core.fsMonitor
+# GIT_PERF_7519_FSMONITOR: used to configure core.fsMonitor. May be an
+# absolute path to an integration. May be a space delimited list of
+# absolute paths to integrations.
#
# The big win for using fsmonitor is the elimination of the need to scan the
# working directory looking for changed and untracked files. If the file
@@ -68,7 +70,7 @@ then
fi
fi
-test_expect_success "setup for fsmonitor" '
+test_expect_success "one time repo setup" '
# set untrackedCache depending on the environment
if test -n "$GIT_PERF_7519_UNTRACKED_CACHE"
then
@@ -88,24 +90,36 @@ test_expect_success "setup for fsmonitor" '
git config core.splitIndex "$GIT_PERF_7519_SPLIT_INDEX"
fi &&
+ mkdir 1_file 10_files 100_files 1000_files 10000_files &&
+ for i in $(test_seq 1 10); do touch 10_files/$i; done &&
+ for i in $(test_seq 1 100); do touch 100_files/$i; done &&
+ for i in $(test_seq 1 1000); do touch 1000_files/$i; done &&
+ for i in $(test_seq 1 10000); do touch 10000_files/$i; done &&
+ git add 1_file 10_files 100_files 1000_files 10000_files &&
+ git commit -qm "Add files" &&
+
+ # If Watchman exists, watch the work tree and attempt a query.
+ if test_have_prereq WATCHMAN; then
+ watchman watch "$GIT_WORK_TREE" &&
+ watchman watch-list | grep -q -F "$GIT_WORK_TREE"
+ fi
+'
+
+setup_for_fsmonitor() {
# set INTEGRATION_SCRIPT depending on the environment
- if test -n "$GIT_PERF_7519_FSMONITOR"
+ if test -n "$INTEGRATION_PATH"
then
- INTEGRATION_SCRIPT="$GIT_PERF_7519_FSMONITOR"
+ INTEGRATION_SCRIPT="$INTEGRATION_PATH"
else
#
# Choose integration script based on existence of Watchman.
- # If Watchman exists, watch the work tree and attempt a query.
- # If everything succeeds, use Watchman integration script,
- # else fall back to an empty integration script.
+ # Fall back to an empty integration script.
#
mkdir .git/hooks &&
if test_have_prereq WATCHMAN
then
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-watchman" &&
- cp "$TEST_DIRECTORY/../templates/hooks--fsmonitor-watchman.sample" "$INTEGRATION_SCRIPT" &&
- watchman watch "$GIT_WORK_TREE" &&
- watchman watch-list | grep -q -F "$GIT_WORK_TREE"
+ cp "$TEST_DIRECTORY/../templates/hooks--fsmonitor-watchman.sample" "$INTEGRATION_SCRIPT"
else
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-empty" &&
write_script "$INTEGRATION_SCRIPT"<<-\EOF
@@ -114,62 +128,94 @@ test_expect_success "setup for fsmonitor" '
fi &&
git config core.fsmonitor "$INTEGRATION_SCRIPT" &&
- git update-index --fsmonitor
-'
-
-if test -n "$GIT_PERF_7519_DROP_CACHE"; then
- test-tool drop-caches
-fi
-
-test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
- git status
-'
+ git update-index --fsmonitor 2>error &&
+ cat error &&
+ [ ! -s error ] # ensure no silent error
+}
+
+test_perf_w_drop_caches () {
+ if test -n "$GIT_PERF_7519_DROP_CACHE"; then
+ test-tool drop-caches
+ fi
-if test -n "$GIT_PERF_7519_DROP_CACHE"; then
- test-tool drop-caches
-fi
+ test_perf "$@"
+}
-test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
- git status -uno
-'
+test_fsmonitor_suite() {
+ if test -n "$INTEGRATION_SCRIPT"; then
+ DESC="fsmonitor=$(basename $INTEGRATION_SCRIPT)"
+ else
+ DESC="fsmonitor=disabled"
+ fi
-if test -n "$GIT_PERF_7519_DROP_CACHE"; then
- test-tool drop-caches
+ test_expect_success "test_initialization" '
+ git reset --hard &&
+ git status # Warm caches
+ '
+
+ test_perf_w_drop_caches "status ($DESC)" '
+ git status
+ '
+
+ test_perf_w_drop_caches "status -uno ($DESC)" '
+ git status -uno
+ '
+
+ test_perf_w_drop_caches "status -uall ($DESC)" '
+ git status -uall
+ '
+
+ test_perf_w_drop_caches "status (dirty) ($DESC)" '
+ git ls-files | head -100000 | xargs -d "\n" touch -h &&
+ git status
+ '
+
+ test_perf_w_drop_caches "diff ($DESC)" '
+ git diff
+ '
+
+ test_perf_w_drop_caches "diff -- 0_files ($DESC)" '
+ git diff -- 1_file
+ '
+
+ test_perf_w_drop_caches "diff -- 10_files ($DESC)" '
+ git diff -- 10_files
+ '
+
+ test_perf_w_drop_caches "diff -- 100_files ($DESC)" '
+ git diff -- 100_files
+ '
+
+ test_perf_w_drop_caches "diff -- 1000_files ($DESC)" '
+ git diff -- 1000_files
+ '
+
+ test_perf_w_drop_caches "diff -- 10000_files ($DESC)" '
+ git diff -- 10000_files
+ '
+
+ test_perf_w_drop_caches "add ($DESC)" '
+ git add --all
+ '
+}
+
+if test -n "$GIT_PERF_7519_FSMONITOR"; then
+ for INTEGRATION_PATH in $GIT_PERF_7519_FSMONITOR; do
+ test_expect_success "setup for fsmonitor $INTEGRATION_PATH" 'setup_for_fsmonitor'
+ test_fsmonitor_suite
+ done
+else
+ test_expect_success "setup for fsmonitor" 'setup_for_fsmonitor'
+ test_fsmonitor_suite
fi
-test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
- git status -uall
-'
-
test_expect_success "setup without fsmonitor" '
unset INTEGRATION_SCRIPT &&
git config --unset core.fsmonitor &&
git update-index --no-fsmonitor
'
-if test -n "$GIT_PERF_7519_DROP_CACHE"; then
- test-tool drop-caches
-fi
-
-test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
- git status
-'
-
-if test -n "$GIT_PERF_7519_DROP_CACHE"; then
- test-tool drop-caches
-fi
-
-test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
- git status -uno
-'
-
-if test -n "$GIT_PERF_7519_DROP_CACHE"; then
- test-tool drop-caches
-fi
-
-test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
- git status -uall
-'
+test_fsmonitor_suite
if test_have_prereq WATCHMAN
then
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 13e389367a..821581a885 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -245,3 +245,5 @@ test_at_end_hook_ () {
test_export () {
export "$@"
}
+
+test_lazy_prereq PERF_EXTRA 'test_bool_env GIT_PERF_EXTRA false'