'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.
This commit is contained in:
Daniel Shahaf 2020-05-04 17:34:59 +00:00
parent 16d818a21f
commit 343ec1061f
1 changed files with 5 additions and 7 deletions

View File

@ -62,8 +62,6 @@ run_test_internal() {
local srcdir="$PWD"
builtin cd -q -- "$tests_tempdir" || { echo >&2 "Bail out! cd failed: $?"; return 1 }
echo -n "# ${1:t:r}: "
# Load the data and prepare checking it.
PREBUFFER= BUFFER= ;
. "$srcdir"/"$1"
@ -71,9 +69,8 @@ run_test_internal() {
# Check the data declares $PREBUFFER or $BUFFER.
[[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; }
# Measure the time taken by _zsh_highlight.
TIMEFMT="%*Es"
{ time (BUFFER="$BUFFER" && _zsh_highlight) } 2>&1
# Set $? for _zsh_highlight
true && _zsh_highlight
}
run_test() {
@ -93,9 +90,10 @@ run_test() {
# Process each test data file in test data directory.
local data_file
for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do
TIMEFMT="%*Es"
{ time (for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do
run_test "$data_file"
(( $pipestatus[1] )) && exit 2
done
done) } 2>&1 || exit $?
exit 0