From ac2e53aab71704d1531d3584e9d06f95bdef77c4 Mon Sep 17 00:00:00 2001 From: matteosz Date: Thu, 29 Feb 2024 21:14:24 +0100 Subject: [PATCH] Automate benchmarks with makefile --- Makefile | 4 ++++ benchmark/bls/benchmark.sh | 9 ++++++--- benchmark/run.sh | 15 +++++++++++++++ benchmark/try/benchmark.sh | 1 + 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 benchmark/run.sh create mode 100755 benchmark/try/benchmark.sh diff --git a/Makefile b/Makefile index f5b2c46aa..ebbaf131c 100644 --- a/Makefile +++ b/Makefile @@ -25,3 +25,7 @@ coverage: tidy # pushing code check: lint vet test echo "check done" + +benchmark: tidy + chmod +x benchmark/run.sh + cd benchmark && ./run.sh diff --git a/benchmark/bls/benchmark.sh b/benchmark/bls/benchmark.sh index b3e1b2c6b..715d1e74f 100755 --- a/benchmark/bls/benchmark.sh +++ b/benchmark/bls/benchmark.sh @@ -1,7 +1,7 @@ #!/bin/bash # It runs the benchmark for the kilic and circl implementations and use benchstat to compare the results. -rounds=6 +rounds=1 # Run the benchmark for the kilic implementation go test -bench=Kilic -run=^$ -count=$rounds > kilic.txt & @@ -10,7 +10,10 @@ go test -bench=Kilic -run=^$ -count=$rounds > kilic.txt & go test -bench=Circl -run=^$ -count=$rounds > circl.txt & wait -echo "Benchmark results are ready." +echo "Benchmark results for bls are ready." # Compare the results -benchstat kilic.txt circl.txt > comparison.txt \ No newline at end of file +benchstat circl.txt kilic.txt > ../results/bls_comparison.txt + +# Delete the temporary files +rm kilic.txt circl.txt \ No newline at end of file diff --git a/benchmark/run.sh b/benchmark/run.sh new file mode 100755 index 000000000..06041fdcf --- /dev/null +++ b/benchmark/run.sh @@ -0,0 +1,15 @@ +# Execute all the benchmarks.sh contained in the subfolders + +# Get the list of all the subfolders +SUBDIRS=$(find . -mindepth 1 -maxdepth 1 -type d -exec test -e '{}/benchmark.sh' ';' -print) + +# Run all the benchmarks +for subdir in $SUBDIRS; do + cd $subdir + echo "Running benchmark for $subdir..." + chmod +x benchmark.sh + ./benchmark.sh + cd .. +done + +echo "All benchmarks have been executed." \ No newline at end of file diff --git a/benchmark/try/benchmark.sh b/benchmark/try/benchmark.sh new file mode 100755 index 000000000..8c2d72c55 --- /dev/null +++ b/benchmark/try/benchmark.sh @@ -0,0 +1 @@ +echo "HELLO" \ No newline at end of file