]>
git.ipfire.org Git - thirdparty/git.git/blob - t/perf/p6300-for-each-ref.sh
3 test_description
='performance of for-each-ref'
8 ref_count_per_type
=10000
9 test_iteration_count
=10
11 test_expect_success
"setup" '
12 test_commit_bulk $(( 1 + $ref_count_per_type )) &&
15 test_seq $ref_count_per_type |
16 sed "s,.*,update refs/heads/branch_& HEAD~&\nupdate refs/custom/special_& HEAD~&," |
17 git update-ref --stdin &&
19 # Create annotated tags
20 for i in $(test_seq $ref_count_per_type)
25 echo "from HEAD~$i" &&
26 printf "tagger %s <%s> %s\n" \
27 "$GIT_COMMITTER_NAME" \
28 "$GIT_COMMITTER_EMAIL" \
29 "$GIT_COMMITTER_DATE" &&
35 echo "tag nested_$i" &&
37 printf "tagger %s <%s> %s\n" \
38 "$GIT_COMMITTER_NAME" \
39 "$GIT_COMMITTER_EMAIL" \
40 "$GIT_COMMITTER_DATE" &&
42 echo "nested tag $i" &&
43 echo "EOF" || return 1
44 done | git fast-import
47 test_for_each_ref
() {
49 if test $# -gt 0; then
56 for i in \$(test_seq $test_iteration_count); do
57 git for-each-ref $args >/dev/null
63 test_for_each_ref
"$1"
64 test_for_each_ref
"$1, no sort" --no-sort
65 test_for_each_ref
"$1, --count=1" --count=1
66 test_for_each_ref
"$1, --count=1, no sort" --no-sort --count=1
67 test_for_each_ref
"$1, tags" refs
/tags
/
68 test_for_each_ref
"$1, tags, no sort" --no-sort refs
/tags
/
69 test_for_each_ref
"$1, tags, dereferenced" '--format="%(refname) %(objectname) %(*objectname)"' refs
/tags
/
70 test_for_each_ref
"$1, tags, dereferenced, no sort" --no-sort '--format="%(refname) %(objectname) %(*objectname)"' refs
/tags
/
72 test_perf
"for-each-ref ($1, tags) + cat-file --batch-check (dereferenced)" "
73 for i in \$(test_seq $test_iteration_count); do
74 git for-each-ref --format='%(objectname)^{} %(refname) %(objectname)' refs/tags/ | \
75 git cat-file --batch-check='%(objectname) %(rest)' >/dev/null
82 test_expect_success
'pack refs' '