Skip to content

Commit 343ec10

Browse files
committed
'make perf': Show only a cumulative datum per highligher, rather than per test file.
The overall per-highlighter duration should be less prone to random noise than the multitude of per-test-file figures.
1 parent 16d818a commit 343ec10

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/test-perfs.zsh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,15 @@ run_test_internal() {
6262
local srcdir="$PWD"
6363
builtin cd -q -- "$tests_tempdir" || { echo >&2 "Bail out! cd failed: $?"; return 1 }
6464

65-
echo -n "# ${1:t:r}: "
66-
6765
# Load the data and prepare checking it.
6866
PREBUFFER= BUFFER= ;
6967
. "$srcdir"/"$1"
7068

7169
# Check the data declares $PREBUFFER or $BUFFER.
7270
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; }
7371

74-
# Measure the time taken by _zsh_highlight.
75-
TIMEFMT="%*Es"
76-
{ time (BUFFER="$BUFFER" && _zsh_highlight) } 2>&1
72+
# Set $? for _zsh_highlight
73+
true && _zsh_highlight
7774
}
7875

7976
run_test() {
@@ -93,9 +90,10 @@ run_test() {
9390

9491
# Process each test data file in test data directory.
9592
local data_file
96-
for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do
93+
TIMEFMT="%*Es"
94+
{ time (for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do
9795
run_test "$data_file"
9896
(( $pipestatus[1] )) && exit 2
99-
done
97+
done) } 2>&1 || exit $?
10098

10199
exit 0

0 commit comments

Comments
 (0)