File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ sources perf-lib.sh:
106106
107107After that you will want to use some of the following:
108108
109+ test_perf_fresh_repo # sets up an empty repository
109110 test_perf_default_repo # sets up a "normal" repository
110111 test_perf_large_repo # sets up a "large" repository
111112
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ test_description=" Tests pathological globbing performance
4+
5+ Shows how Git's globbing performance performs when given the sort of
6+ pathological patterns described in at https://research.swtch.com/glob
7+ "
8+
9+ . ./perf-lib.sh
10+
11+ test_globs_big=' 10 25 50 75 100'
12+ test_globs_small=' 1 2 3 4 5 6'
13+
14+ test_perf_fresh_repo
15+
16+ test_expect_success ' setup' '
17+ for i in $(test_seq 1 100)
18+ do
19+ printf "a" >>refname &&
20+ for j in $(test_seq 1 $i)
21+ do
22+ printf "a*" >>refglob.$i
23+ done &&
24+ echo b >>refglob.$i
25+ done &&
26+ test_commit test $(cat refname).t "" $(cat refname).t
27+ '
28+
29+ for i in $test_globs_small
30+ do
31+ test_perf " refglob((a*)^nb) against tag (a^100).t; n = $i " '
32+ git for-each-ref "refs/tags/$(cat refglob.' $i ' )b"
33+ '
34+ done
35+
36+ for i in $test_globs_small
37+ do
38+ test_perf " fileglob((a*)^nb) against file (a^100).t; n = $i " '
39+ git ls-files "$(cat refglob.' $i ' )b"
40+ '
41+ done
42+
43+ test_done
Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ if test -z "$GIT_PERF_LARGE_REPO"; then
7878 GIT_PERF_LARGE_REPO=$TEST_DIRECTORY /..
7979fi
8080
81+ test_perf_do_repo_symlink_config_ () {
82+ test_have_prereq SYMLINKS || git config core.symlinks false
83+ }
84+
8185test_perf_create_repo_from () {
8286 test " $# " = 2 ||
8387 error " bug in the test script: not 2 parameters to test-create-repo"
@@ -102,15 +106,22 @@ test_perf_create_repo_from () {
102106 ) &&
103107 (
104108 cd " $repo " &&
105- " $MODERN_GIT " init -q && {
106- test_have_prereq SYMLINKS ||
107- git config core.symlinks false
108- } &&
109+ " $MODERN_GIT " init -q &&
110+ test_perf_do_repo_symlink_config_ &&
109111 mv .git/hooks .git/hooks-disabled 2> /dev/null
110112 ) || error " failed to copy repository '$source ' to '$repo '"
111113}
112114
113115# call at least one of these to establish an appropriately-sized repository
116+ test_perf_fresh_repo () {
117+ repo=" ${1:- $TRASH_DIRECTORY } "
118+ " $MODERN_GIT " init -q " $repo " &&
119+ (
120+ cd " $repo " &&
121+ test_perf_do_repo_symlink_config_
122+ )
123+ }
124+
114125test_perf_default_repo () {
115126 test_perf_create_repo_from " ${1:- $TRASH_DIRECTORY } " " $GIT_PERF_REPO "
116127}
You can’t perform that action at this time.
0 commit comments