tree-sitter/script/benchmark
2019-08-02 12:04:31 -07:00

42 lines
730 B
Bash
Executable file

#!/usr/bin/env bash
set -e
function usage {
cat <<-EOF
USAGE
$0 [-h] [-l language-name] [-e example-file-name] [-r repetition-count]
OPTIONS
-h print this message
-l run only the benchmarks for the given language
-e run only the benchmarks that parse the example file with the given name
-r parse each sample the given number of times (default 5)
EOF
}
while getopts "hl:e:r:" option; do
case ${option} in
h)
usage
exit
;;
e)
export TREE_SITTER_BENCHMARK_EXAMPLE_FILTER=${OPTARG}
;;
l)
export TREE_SITTER_BENCHMARK_LANGUAGE_FILTER=${OPTARG}
;;
r)
export TREE_SITTER_BENCHMARK_REPETITION_COUNT=${OPTARG}
;;
esac
done
cargo bench