tree-sitter/script/benchmark
Max Brunsfeld 4cac85fec4 Add benchmark script
* Structure `cli` crate as both a library and an executable, so that
benchmarks can import code from the crate.
* Import macros in the Rust 2018 style.
2019-02-01 15:17:35 -08:00

37 lines
565 B
Bash
Executable file

#!/usr/bin/env bash
set -e
function usage {
cat <<-EOF
USAGE
$0 [-h] [-l language-name] [-e example-file-name]
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
EOF
}
while getopts "hl:e:" option; do
case ${option} in
h)
usage
exit
;;
e)
export TREE_SITTER_BENCHMARK_EXAMPLE_FILTER=${OPTARG}
;;
l)
export TREE_SITTER_BENCHMARK_LANGUAGE_FILTER=${OPTARG}
;;
esac
done
cargo bench