perf: fixes and cleanups
cover perf: fixes and cleanups
Just for the sake of it I tried to make perf for the first time and it didn't work. What follows are some fixes and cleanups I found along the way.
One problem should have prevented this target to build since six months ago, I'm surprised nobody has seen it. Maybe more people should try GIT_PERF_REPEAT_COUNT=1 make perf just to make sure it builds.
Felipe Contreras (5):
perf: sparse: remove grep --sparse option
perf: grep: fix prereqs
perf: grep: don't check PRCE twice
perf: grep: avoid unused prereq
perf: aggregate: check if subtest exists
t/perf/aggregate.perl | 1 + t/perf/p2000-sparse-operations.sh | 2 +- t/perf/p4220-log-grep-engines.sh | 2 +- t/perf/p4221-log-grep-engines-fixed.sh | 2 +- t/perf/p7820-grep-engines.sh | 11 +++-------- t/perf/p7821-grep-engines-fixed.sh | 15 +++++---------- t/perf/p7822-grep-perl-character.sh | 7 +------ 7 files changed, 13 insertions(+), 27 deletions(-)
Signature · 1 line
2.39.2.13.g1fb56cf030
PATCH 1/5 perf: sparse: remove grep --sparse option
It was never added.
--- t/perf/p2000-sparse-operations.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/perf/p2000-sparse-operations.sh +1 -1
@@ -124,6 +124,6 @@ test_perf_on_all git read-tree -mu HEAD test_perf_on_all git checkout-index -f --all test_perf_on_all git update-index --add --remove $SPARSE_CONE/a test_perf_on_all "git rm -f $SPARSE_CONE/a && git checkout HEAD -- $SPARSE_CONE/a" -test_perf_on_all git grep --cached --sparse bogus -- "f2/f1/f1/*" +test_perf_on_all git grep --cached bogus -- "f2/f1/f1/*" test_done
Signature · 1 line
2.39.2.13.g1fb56cf030
PATCH 2/5 perf: grep: fix prereqs
In reply to Felipe ContrerasSince 5dccd9155f (t/perf: add iteration setup mechanism to perf-lib, 2022-04-04) they are in a --prereq option.
--- t/perf/p7821-grep-engines-fixed.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
t/perf/p7821-grep-engines-fixed.sh +2 -2
@@ -33,13 +33,13 @@ do fi if ! test_have_prereq PERF_GREP_ENGINES_THREADS then - test_perf $prereq "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern" " + test_perf "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern" --prereq "$prereq" " git -c grep.patternType=$engine grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine' || : " else for threads in $GIT_PERF_GREP_THREADS do - test_perf PTHREADS,$prereq "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern with $threads threads" " + test_perf "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern with $threads threads" --prereq "$prereq" " git -c grep.patternType=$engine -c grep.threads=$threads grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine.$threads' || : " done
Signature · 1 line
2.39.2.13.g1fb56cf030
PATCH 3/5 perf: grep: don't check PRCE twice
In reply to Felipe ContrerasJust set the prereq and let the testing framework check it once.
--- t/perf/p4220-log-grep-engines.sh | 2 +- t/perf/p4221-log-grep-engines-fixed.sh | 2 +- t/perf/p7820-grep-engines.sh | 2 +- t/perf/p7821-grep-engines-fixed.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
t/perf/p4220-log-grep-engines.sh +1 -1
@@ -30,7 +30,7 @@ do # Poor man's basic -> extended converter. pattern=$(echo $pattern | sed 's/\\//g') fi - if test $engine = "perl" && ! test_have_prereq PCRE + if test $engine = "perl" then prereq="PCRE" else
t/perf/p4221-log-grep-engines-fixed.sh +1 -1
@@ -20,7 +20,7 @@ for pattern in 'int' 'uncommon' 'æ' do for engine in fixed basic extended perl do - if test $engine = "perl" && ! test_have_prereq PCRE + if test $engine = "perl" then prereq="PCRE" else
t/perf/p7820-grep-engines.sh +1 -1
@@ -41,7 +41,7 @@ do # Poor man's basic -> extended converter. pattern=$(echo "$pattern" | sed 's/\\//g') fi - if test $engine = "perl" && ! test_have_prereq PCRE + if test $engine = "perl" then prereq="PCRE" else
t/perf/p7821-grep-engines-fixed.sh +1 -1
@@ -25,7 +25,7 @@ for pattern in 'int' 'uncommon' 'æ' do for engine in fixed basic extended perl do - if test $engine = "perl" && ! test_have_prereq PCRE + if test $engine = "perl" then prereq="PCRE" else
Signature · 1 line
2.39.2.13.g1fb56cf030
PATCH 4/5 perf: grep: avoid unused prereq
In reply to Felipe ContrerasThere is no point in setting PERF_GREP_ENGINES_THREADS if we are going to check it ourselves.
--- t/perf/p7820-grep-engines.sh | 9 ++------- t/perf/p7821-grep-engines-fixed.sh | 9 ++------- t/perf/p7822-grep-perl-character.sh | 7 +------ 3 files changed, 5 insertions(+), 20 deletions(-)
t/perf/p7820-grep-engines.sh +2 -7
@@ -22,11 +22,6 @@ etc.) we will test the patterns under those numbers of threads. test_perf_large_repo test_checkout_worktree -if test -n "$GIT_PERF_GREP_THREADS" -then - test_set_prereq PERF_GREP_ENGINES_THREADS -fi - for pattern in \ 'how.to' \ '^how to' \
@@ -47,7 +42,7 @@ do else prereq="" fi - if ! test_have_prereq PERF_GREP_ENGINES_THREADS + if test -z "$GIT_PERF_GREP_THREADS" then test_perf "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern'" \ --prereq "$prereq" "
@@ -64,7 +59,7 @@ do fi done - if ! test_have_prereq PERF_GREP_ENGINES_THREADS + if test -z "$GIT_PERF_GREP_THREADS" then test_expect_success "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern'" ' test_cmp out.basic out.extended &&
t/perf/p7821-grep-engines-fixed.sh +2 -7
@@ -16,11 +16,6 @@ etc.) we will test the patterns under those numbers of threads. test_perf_large_repo test_checkout_worktree -if test -n "$GIT_PERF_GREP_THREADS" -then - test_set_prereq PERF_GREP_ENGINES_THREADS -fi - for pattern in 'int' 'uncommon' 'æ' do for engine in fixed basic extended perl
@@ -31,7 +26,7 @@ do else prereq="" fi - if ! test_have_prereq PERF_GREP_ENGINES_THREADS + if test -z "$GIT_PERF_GREP_THREADS" then test_perf "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern" --prereq "$prereq" " git -c grep.patternType=$engine grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine' || :
@@ -46,7 +41,7 @@ do fi done - if ! test_have_prereq PERF_GREP_ENGINES_THREADS + if test -z "$GIT_PERF_GREP_THREADS" then test_expect_success "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS $pattern" ' test_cmp out.fixed out.basic &&
t/perf/p7822-grep-perl-character.sh +1 -6
@@ -11,11 +11,6 @@ etc.) we will test the patterns under those numbers of threads. test_perf_large_repo test_checkout_worktree -if test -n "$GIT_PERF_GREP_THREADS" -then - test_set_prereq PERF_GREP_ENGINES_THREADS -fi - for pattern in \ '\\bhow' \ '\\bÆvar' \
@@ -24,7 +19,7 @@ for pattern in \ '\\w{12}\\b' do echo '$pattern' >pat - if ! test_have_prereq PERF_GREP_ENGINES_THREADS + if test -z "$GIT_PERF_GREP_THREADS" then test_perf "grep -P '$pattern'" --prereq PCRE " git -P grep -f pat || :
Signature · 1 line
2.39.2.13.g1fb56cf030
PATCH 5/5 perf: aggregate: check if subtest exists
In reply to Felipe ContrerasIf no tests were run, for example in p7822-grep-perl-character.sh, that's not a fatal error, just skip to the next one.
--- t/perf/aggregate.perl | 1 + 1 file changed, 1 insertion(+)
t/perf/aggregate.perl +1 -0
@@ -156,6 +156,7 @@ sub sane_backticks { $t =~ s{(?:.*/)?(p(\d+)-[^/]+)\.sh$}{$1} or die "bad test name: $t"; my $n = $2; my $fname = "$resultsdir/$t.subtests"; + next unless (-e $fname); open my $fp, "<", $fname or die "cannot open $fname: $!"; for (<$fp>) { chomp;
Signature · 1 line
2.39.2.13.g1fb56cf030