on master help sign in
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

commit747b15436aca980ea09af88f41e3f14dfb89afba authorMartin Nordholts <enselic@gmail.com> dateFri 26 Nov 2021, 20:58 (5 years ago) parent206bf5b
2 files changed+13−2
tests/benchmarks/run-benchmarks.sh+12−2 tests/benchmarks/test-src/small-CpuInfo-file.cpuinfo+1
tests/benchmarks/run-benchmarks.sh+12−2
@@ -95,14 +95,24 @@ cat "$RESULT_DIR/startup-time.md" >> "$REPORT"
9595
9696heading "Startup time with syntax highlighting"
9797hyperfine \
98− "$(printf "%q" "$BAT") --no-config --color=always test-src/small-Markdown-file.md" \
99− --command-name "bat … small-Markdown-file.md" \
98+ "$(printf "%q" "$BAT") --no-config --color=always test-src/small-CpuInfo-file.cpuinfo" \
99+ --command-name "bat … small-CpuInfo-file.cpuinfo" \
100100 --warmup "$WARMUP_COUNT" \
101101 --export-markdown "$RESULT_DIR/startup-time-with-syntax-highlighting.md" \
102102 --export-json "$RESULT_DIR/startup-time-with-syntax-highlighting.json"
103103cat "$RESULT_DIR/startup-time-with-syntax-highlighting.md" >> "$REPORT"
104104
105105
106+heading "Startup time with syntax with dependencies"
107+hyperfine \
108+ "$(printf "%q" "$BAT") --no-config --color=always test-src/small-Markdown-file.md" \
109+ --command-name "bat … small-Markdown-file.md" \
110+ --warmup "$WARMUP_COUNT" \
111+ --export-markdown "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" \
112+ --export-json "$RESULT_DIR/startup-time-with-syntax-with-dependencies.json"
113+cat "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" >> "$REPORT"
114+
115+
106116heading "Plain-text speed"
107117hyperfine \
108118 "$(printf "%q" "$BAT") --no-config --language=txt --style=plain test-src/numpy_test_multiarray.py" \
tests/benchmarks/test-src/small-CpuInfo-file.cpuinfonew file+1
@@ -0,0 +1 @@
1+OneColor : AnotherColor