Add benchmark scripts to 2024

This commit is contained in:
Jonas Meeuws 2024-12-01 20:51:44 +01:00
parent 2c622da458
commit d48ed5a00d
No known key found for this signature in database
GPG key ID: BC0C864CF04D9AC4
4 changed files with 57 additions and 1 deletions

1
2024/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
inputs

20
2024/benchmark Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
day="$(printf '%02d' ${1##0})"
part="$2"
inputfile="$PWD/../inputs/${day}.txt"
[ -x "prepare" ] || exit 0
if ! ./prepare "$day" "$part"; then
echo 'eh ge hebt precies niet alles geïnstalleerd staan'
else
if [ -x "run" ]; then
hyperfine "./run '$day' '$part' '$inputfile'"
fi
fi
if [ -x "clean" ]; then
./clean
fi
true

35
2024/complete-benchmark Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
day="$(printf '%02d' ${1##0})"
part="$2"
inputfile="$3"
case "$inputfile" in
"") inputfile="$PWD/francis-punt/${day}_input.txt";;
/*) ;;
*) inputfile="$PWD/$inputfile";;
esac
if ! test -f "$inputfile"; then
echo "no input available" >&2
exit 1
fi
for dir in *; do
if test -d "$dir"; then
cd "$dir"
if test -x ./prepare; then
echo "---------------------------------------------------------------------------------- $dir"
if ! ./prepare "$day" "$part" >&2; then
echo 'eh ge hebt precies niet alles geïnstalleerd staan'
else
if test -x run; then
hyperfine -n "$dir" "./run '$day' '$part' '$inputfile'"
fi
fi
fi
if test -x ./clean; then
./clean "$day" "$part" "$inputfile"
fi
cd - > /dev/null 2>&1
fi
done

@ -1 +1 @@
Subproject commit 2cac13e2408c975828b531f5f0f3af9a98e4d10a
Subproject commit d517bada96a2d890d41cdc1c7284e91f3845d45f