2018-08-24 15:46:42 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
[ "$1" = "--full" ] && FULL=true || FULL=false
|
|
|
|
|
|
|
|
echo 'Tokei Benchmarking Tool'
|
|
|
|
|
|
|
|
if [ $FULL = true ]; then
|
2018-08-25 20:10:34 +00:00
|
|
|
REQUIRED='cloc, tokei, loc, hyperfine, and scc'
|
2018-08-24 15:46:42 +00:00
|
|
|
else
|
2018-08-25 20:10:34 +00:00
|
|
|
REQUIRED='tokei, and hyperfine'
|
2018-08-24 15:46:42 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "The use of this tool requires $REQUIRED to be installed and available in your PATH variable."
|
|
|
|
|
|
|
|
echo 'Please enter the path you would like to benchmark:'
|
|
|
|
|
|
|
|
read input
|
|
|
|
|
|
|
|
hyperfine --version
|
|
|
|
echo "old tokei: $(tokei --version)"
|
|
|
|
|
|
|
|
if [ $FULL = true ]; then
|
2018-08-25 20:10:34 +00:00
|
|
|
scc --version
|
2018-08-24 15:46:42 +00:00
|
|
|
loc --version
|
2018-08-25 20:10:34 +00:00
|
|
|
echo "cloc: $(cloc --version)"
|
2018-08-24 15:46:42 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
if [ $FULL = true ]; then
|
2018-08-25 20:10:34 +00:00
|
|
|
hyperfine -w 5 "target/release/tokei $input" \
|
|
|
|
"tokei $input" \
|
|
|
|
"scc $input" \
|
|
|
|
"loc $input" \
|
|
|
|
"cloc $input"
|
2018-08-24 15:46:42 +00:00
|
|
|
else
|
|
|
|
hyperfine -w 5 "target/release/tokei $input"\
|
2018-08-25 20:10:34 +00:00
|
|
|
"tokei $input"
|
2018-08-24 15:46:42 +00:00
|
|
|
fi
|