|
|
|
@ -9,6 +9,13 @@ if ! command -v hyperfine > /dev/null 2>&1; then
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check that jq is installed.
|
|
|
|
|
if ! command -v jq > /dev/null 2>&1; then
|
|
|
|
|
echo "'jq' does not seem to be installed."
|
|
|
|
|
echo "You can get it here: https://jqlang.github.io/jq/download/"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check that python3 is installed.
|
|
|
|
|
if ! command -v python3 > /dev/null 2>&1; then
|
|
|
|
|
echo "'python3' does not seem to be installed."
|
|
|
|
@ -117,6 +124,49 @@ hyperfine \
|
|
|
|
|
cat "$RESULT_DIR/startup-time-with-syntax-with-dependencies.md" >> "$REPORT"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
heading "Startup time with indeterminant syntax"
|
|
|
|
|
hyperfine \
|
|
|
|
|
"$(printf "%q" "$BAT") --no-config startup-time-src/mystery-file" \
|
|
|
|
|
--command-name 'bat … mystery-file' \
|
|
|
|
|
--warmup "$WARMUP_COUNT" \
|
|
|
|
|
--runs $(($RUN_COUNT * 100)) \
|
|
|
|
|
--export-markdown "$RESULT_DIR/startup-time-with-indeterminant-syntax.md" \
|
|
|
|
|
--export-json "$RESULT_DIR/startup-time-with-indeterminant-syntax.json"
|
|
|
|
|
cat "$RESULT_DIR/startup-time-with-indeterminant-syntax.md" >> "$REPORT"
|
|
|
|
|
|
|
|
|
|
heading "Startup time with manually set syntax"
|
|
|
|
|
hyperfine \
|
|
|
|
|
"$(printf "%q" "$BAT") --no-config --language=Dockerfile startup-time-src/mystery-file" \
|
|
|
|
|
--command-name 'bat … --language=Dockerfile mystery-file' \
|
|
|
|
|
--warmup "$WARMUP_COUNT" \
|
|
|
|
|
--runs $(($RUN_COUNT * 100)) \
|
|
|
|
|
--export-markdown "$RESULT_DIR/startup-time-with-manually-set-syntax.md" \
|
|
|
|
|
--export-json "$RESULT_DIR/startup-time-with-manually-set-syntax.json"
|
|
|
|
|
cat "$RESULT_DIR/startup-time-with-manually-set-syntax.md" >> "$REPORT"
|
|
|
|
|
|
|
|
|
|
heading "Startup time with mapped syntax"
|
|
|
|
|
hyperfine \
|
|
|
|
|
"$(printf "%q" "$BAT") --no-config startup-time-src/Containerfile" \
|
|
|
|
|
--command-name 'bat … Containerfile' \
|
|
|
|
|
--warmup "$WARMUP_COUNT" \
|
|
|
|
|
--runs $(($RUN_COUNT * 100)) \
|
|
|
|
|
--export-markdown "$RESULT_DIR/startup-time-with-mapped-syntax.md" \
|
|
|
|
|
--export-json "$RESULT_DIR/startup-time-with-mapped-syntax.json"
|
|
|
|
|
cat "$RESULT_DIR/startup-time-with-mapped-syntax.md" >> "$REPORT"
|
|
|
|
|
|
|
|
|
|
AVG_TIMES=()
|
|
|
|
|
for KIND in indeterminant manually-set mapped; do
|
|
|
|
|
JSON_SRC="$RESULT_DIR/startup-time-with-$KIND-syntax.json"
|
|
|
|
|
AVG=$(jq -r '.results[0].mean' "$JSON_SRC")
|
|
|
|
|
AVG_TIMES+=("$AVG")
|
|
|
|
|
done
|
|
|
|
|
# indeterminant should be slower, because it necessarily has to evaluate all rules
|
|
|
|
|
# to ensure that nothing matches; manually-set and mapped should both be faster
|
|
|
|
|
# because most or all GlobMatcher builds are skipped
|
|
|
|
|
python3 -c "if ${AVG_TIMES[0]} < ${AVG_TIMES[1]}: print('WARN: indeterminant syntax has faster startup than manually set syntax!')"
|
|
|
|
|
python3 -c "if ${AVG_TIMES[0]} < ${AVG_TIMES[2]}: print('WARN: indeterminant syntax has faster startup than mapped syntax!')"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
heading "Plain-text speed"
|
|
|
|
|
hyperfine \
|
|
|
|
|
"$(printf "%q" "$BAT") --no-config --language=txt --style=plain highlighting-speed-src/numpy_test_multiarray.py" \
|
|
|
|
|