From d48ed5a00d6dce3fbe8f8e466fbf618d090d5d96 Mon Sep 17 00:00:00 2001 From: Jonas Meeuws Date: Sun, 1 Dec 2024 20:51:44 +0100 Subject: [PATCH] Add benchmark scripts to 2024 --- 2024/.gitignore | 1 + 2024/benchmark | 20 ++++++++++++++++++++ 2024/complete-benchmark | 35 +++++++++++++++++++++++++++++++++++ 2024/jnms | 2 +- 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 2024/.gitignore create mode 100755 2024/benchmark create mode 100755 2024/complete-benchmark diff --git a/2024/.gitignore b/2024/.gitignore new file mode 100644 index 0000000..15d7aef --- /dev/null +++ b/2024/.gitignore @@ -0,0 +1 @@ +inputs diff --git a/2024/benchmark b/2024/benchmark new file mode 100755 index 0000000..10fd522 --- /dev/null +++ b/2024/benchmark @@ -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 diff --git a/2024/complete-benchmark b/2024/complete-benchmark new file mode 100755 index 0000000..b779f92 --- /dev/null +++ b/2024/complete-benchmark @@ -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 diff --git a/2024/jnms b/2024/jnms index 2cac13e..d517bad 160000 --- a/2024/jnms +++ b/2024/jnms @@ -1 +1 @@ -Subproject commit 2cac13e2408c975828b531f5f0f3af9a98e4d10a +Subproject commit d517bada96a2d890d41cdc1c7284e91f3845d45f