diff options
Diffstat (limited to 't/perf')
-rw-r--r-- | t/perf/.gitignore | 5 | ||||
-rw-r--r-- | t/perf/README | 4 | ||||
-rwxr-xr-x | t/perf/p0001-rev-list.sh | 12 | ||||
-rwxr-xr-x | t/perf/p0002-read-cache.sh | 14 | ||||
-rwxr-xr-x | t/perf/p4001-diff-no-index.sh | 22 | ||||
-rwxr-xr-x | t/perf/p4211-line-log.sh | 34 | ||||
-rwxr-xr-x | t/perf/p5302-pack-index.sh | 40 | ||||
-rw-r--r-- | t/perf/perf-lib.sh | 14 |
8 files changed, 136 insertions, 9 deletions
diff --git a/t/perf/.gitignore b/t/perf/.gitignore index 50f5cc1ed9..982eb8e3a9 100644 --- a/t/perf/.gitignore +++ b/t/perf/.gitignore @@ -1,2 +1,3 @@ -build/ -test-results/ +/build/ +/test-results/ +/trash directory*/ diff --git a/t/perf/README b/t/perf/README index b2dbad4d50..8848c14619 100644 --- a/t/perf/README +++ b/t/perf/README @@ -56,7 +56,7 @@ You can set the following variables (also in your config.mak): GIT_PERF_REPEAT_COUNT Number of times a test should be repeated for best-of-N - measurements. Defaults to 5. + measurements. Defaults to 3. GIT_PERF_MAKE_OPTS Options to use when automatically building a git tree for @@ -66,7 +66,7 @@ You can set the following variables (also in your config.mak): GIT_PERF_LARGE_REPO Repositories to copy for the performance tests. The normal repo should be at least git.git size. The large repo should - probably be about linux-2.6.git size for optimal results. + probably be about linux.git size for optimal results. Both default to the git.git you are running from. You can also pass the options taken by ordinary git tests; the most diff --git a/t/perf/p0001-rev-list.sh b/t/perf/p0001-rev-list.sh index 4f71a63b0a..16359d51ae 100755 --- a/t/perf/p0001-rev-list.sh +++ b/t/perf/p0001-rev-list.sh @@ -14,4 +14,16 @@ test_perf 'rev-list --all --objects' ' git rev-list --all --objects >/dev/null ' +test_expect_success 'create new unreferenced commit' ' + commit=$(git commit-tree HEAD^{tree} -p HEAD) +' + +test_perf 'rev-list $commit --not --all' ' + git rev-list $commit --not --all >/dev/null +' + +test_perf 'rev-list --objects $commit --not --all' ' + git rev-list --objects $commit --not --all >/dev/null +' + test_done diff --git a/t/perf/p0002-read-cache.sh b/t/perf/p0002-read-cache.sh new file mode 100755 index 0000000000..9180ae9343 --- /dev/null +++ b/t/perf/p0002-read-cache.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +test_description="Tests performance of reading the index" + +. ./perf-lib.sh + +test_perf_default_repo + +count=1000 +test_perf "read_cache/discard_cache $count times" " + test-read-cache $count +" + +test_done diff --git a/t/perf/p4001-diff-no-index.sh b/t/perf/p4001-diff-no-index.sh new file mode 100755 index 0000000000..683be6984f --- /dev/null +++ b/t/perf/p4001-diff-no-index.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +test_description="Test diff --no-index performance" + +. ./perf-lib.sh + +test_perf_large_repo +test_checkout_worktree + +file1=$(git ls-files | tail -n 2 | head -1) +file2=$(git ls-files | tail -n 1 | head -1) + +test_expect_success "empty files, so they take no time to diff" " + echo >$file1 && + echo >$file2 +" + +test_perf "diff --no-index" " + git diff --no-index $file1 $file2 >/dev/null +" + +test_done diff --git a/t/perf/p4211-line-log.sh b/t/perf/p4211-line-log.sh new file mode 100755 index 0000000000..3d074b0e41 --- /dev/null +++ b/t/perf/p4211-line-log.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +test_description='Tests log -L performance' +. ./perf-lib.sh + +test_perf_default_repo + +# Pick a file to log pseudo-randomly. The sort key is the blob hash, +# so it is stable. +test_expect_success 'select a file' ' + git ls-tree HEAD | grep ^100644 | + sort -k 3 | head -1 | cut -f 2 >filelist +' + +file=$(cat filelist) +export file + +test_perf 'git rev-list --topo-order (baseline)' ' + git rev-list --topo-order HEAD >/dev/null +' + +test_perf 'git log --follow (baseline for -M)' ' + git log --oneline --follow -- "$file" >/dev/null +' + +test_perf 'git log -L' ' + git log -L 1:"$file" >/dev/null +' + +test_perf 'git log -M -L' ' + git log -M -L 1:"$file" >/dev/null +' + +test_done diff --git a/t/perf/p5302-pack-index.sh b/t/perf/p5302-pack-index.sh new file mode 100755 index 0000000000..6cb5b0d55b --- /dev/null +++ b/t/perf/p5302-pack-index.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +test_description="Tests index-pack performance" + +. ./perf-lib.sh + +test_perf_large_repo + +test_expect_success 'repack' ' + git repack -ad && + PACK=`ls .git/objects/pack/*.pack | head -n1` && + test -f "$PACK" && + export PACK +' + +test_perf 'index-pack 0 threads' ' + GIT_DIR=t1 git index-pack --threads=1 --stdin < $PACK +' + +test_perf 'index-pack 1 thread ' ' + GIT_DIR=t2 GIT_FORCE_THREADS=1 git index-pack --threads=1 --stdin < $PACK +' + +test_perf 'index-pack 2 threads' ' + GIT_DIR=t3 git index-pack --threads=2 --stdin < $PACK +' + +test_perf 'index-pack 4 threads' ' + GIT_DIR=t4 git index-pack --threads=4 --stdin < $PACK +' + +test_perf 'index-pack 8 threads' ' + GIT_DIR=t5 git index-pack --threads=8 --stdin < $PACK +' + +test_perf 'index-pack default number of threads' ' + GIT_DIR=t6 git index-pack --stdin < $PACK +' + +test_done diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh index 5580c22812..a8c9574291 100644 --- a/t/perf/perf-lib.sh +++ b/t/perf/perf-lib.sh @@ -1,4 +1,6 @@ -#!/bin/sh +# Performance testing framework. Each perf script starts much like +# a normal test script, except it sources this library instead of +# test-lib.sh. See t/perf/README for documentation. # # Copyright (c) 2011 Thomas Rast # @@ -42,6 +44,7 @@ else fi TEST_NO_CREATE_REPO=t +TEST_NO_MALLOC_CHECK=t . ../test-lib.sh @@ -149,6 +152,7 @@ exit $ret' >&3 2>&4 test_perf () { + test_start_ test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq= test "$#" = 2 || error "bug in the test script: not 2 or 3 parameters to test-expect-success" @@ -159,16 +163,16 @@ test_perf () { echo "$test_count" >>"$perf_results_dir"/$base.subtests echo "$1" >"$perf_results_dir"/$base.$test_count.descr if test -z "$verbose"; then - echo -n "perf $test_count - $1:" + printf "%s" "perf $test_count - $1:" else echo "perf $test_count - $1:" fi - for i in $(seq 1 $GIT_PERF_REPEAT_COUNT); do + for i in $(test_seq 1 $GIT_PERF_REPEAT_COUNT); do say >&3 "running: $2" if test_run_perf_ "$2" then if test -z "$verbose"; then - echo -n " $i" + printf " %s" "$i" else echo "* timing run $i/$GIT_PERF_REPEAT_COUNT:" fi @@ -186,7 +190,7 @@ test_perf () { base="$perf_results_dir"/"$perf_results_prefix$(basename "$0" .sh)"."$test_count" "$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".times fi - echo >&3 "" + test_finish_ } # We extend test_done to print timings at the end (./run disables this |