run-benchmarks.sh: Add third 'Startup time' variant

Using Markdown for a startup test is useful since it has so many dependencies on
other syntaxes. So such a test makes sure that lazy-loading of syntaxes work.

It is however also useful to measure the startup time of bat when the time to
load a syntax is very small, and the measured startup time has mostly non-syntax
related causes. Such as:
 * Parsing arguments
 * Setting up syntax mapping
 * Loading themes

This commit adds such a test. It uses the CpuInfo syntax which is very small.
Only 14 lines, compared to the 1581 lines that Markdown is (not including the
size of its included syntaxes).

This command can be used to get an approximation of the size of syntaxes, and
thus how expensive they are to load:

    find -name *.sublime-syntax -print0 | xargs --null wc -l | sort -n -r
This commit is contained in:
Martin Nordholts 2021-11-26 20:58:33 +01:00
parent 206bf5b8d6
commit 747b15436a
2 changed files with 13 additions and 2 deletions

View File

@ -95,14 +95,24 @@ cat "$RESULT_DIR/startup-time.md" >> "$REPORT"
heading "Startup time with syntax highlighting"
hyperfine \
"$(printf "%q" "$BAT") --no-config --color=always test-src/small-Markdown-file.md" \
--command-name "bat … small-Markdown-file.md" \
"$(printf "%q" "$BAT") --no-config --color=always test-src/small-CpuInfo-file.cpuinfo" \
--command-name "bat … small-CpuInfo-file.cpuinfo" \
--warmup "$WARMUP_COUNT" \
--export-markdown "$RESULT_DIR/startup-time-with-syntax-highlighting.md" \
--export-json "$RESULT_DIR/startup-time-with-syntax-highlighting.json"
cat "$RESULT_DIR/startup-time-with-syntax-highlighting.md" >> "$REPORT"
heading "Startup time with syntax with dependencies"
hyperfine \
"$(printf "%q" "$BAT") --no-config --color=always test-src/small-Markdown-file.md" \
--command-name "bat … small-Markdown-file.md" \
--warmup "$WARMUP_COUNT" \
--export-markdown "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" \
--export-json "$RESULT_DIR/startup-time-with-syntax-with-dependencies.json"
cat "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" >> "$REPORT"
heading "Plain-text speed"
hyperfine \
"$(printf "%q" "$BAT") --no-config --language=txt --style=plain test-src/numpy_test_multiarray.py" \

View File

@ -0,0 +1 @@
OneColor : AnotherColor