mirror of https://github.com/Wilfred/difftastic/
add timing info to example parsing output
parent
812426ddba
commit
e0da97b2a1
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
name=$1
|
||||
root=$(dirname $(dirname $(realpath "$0")))
|
||||
cd $root
|
||||
|
||||
repo=examples/$name
|
||||
|
||||
known_failures=$(cat "script/known-failures-$name.txt")
|
||||
examples_to_parse=$(
|
||||
for example in $(find "$repo" -name '*.hs'); do
|
||||
if [[ ! $known_failures == *$example* ]]; then
|
||||
echo $example
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
start=$(date '+%s.%N')
|
||||
echo $examples_to_parse | xargs -n 2000 tree-sitter parse -q
|
||||
end=$(date '+%s.%N')
|
||||
|
||||
skipped=$( echo $known_failures | wc -w )
|
||||
parsed=$( echo $examples_to_parse | wc -w )
|
||||
total=$((parsed+skipped))
|
||||
percent=$(bc -l <<< "100*$parsed/$total")
|
||||
duration=$(bc -l <<< "$end - $start")
|
||||
|
||||
printf "Successfully parsed %.2f%% of '$name' in %.2fs (%d of %d files)\n" $percent $duration $parsed $total
|
||||
Loading…
Reference in New Issue