blog/bench.sh

23 lines
657 B
Bash
Raw Normal View History

2024-06-19 18:53:44 +00:00
#!/usr/bin/env bash
amt=$1
if [[ -z "$amt" ]]; then
echo "ERROR: pass number of test posts for bench" 1>&2
exit 1
fi
echo "INFO: removing old __bench files" 1>&2
rm -f ./posts/*__bench*
for i in $(seq 1 "$amt"); do
cp ./posts/build_a_blog.md ./posts/build_a_blog_${i}__bench.md
done
echo "INFO: number of *.md files $(find ./posts/ -iname '*.md' | wc -l)" 1>&2
echo "INFO: number of *.html files $(find ./posts/ -iname '*.html' | wc -l)" 1>&2
echo "INFO: running" 1>&2
time -p python main.py 2>/dev/null
echo "INFO: number of *.html files $(find ./posts/ -iname '*.html' | wc -l)" 1>&2
echo "INFO: cleanup __bench files" 1>&2
rm -f ./posts/*__bench*