Skip to content

Commit

Permalink
Automate benchmarks with makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
matteosz committed Feb 29, 2024
1 parent 2a28ef9 commit ac2e53a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 6 additions & 3 deletions benchmark/bls/benchmark.sh
Original file line number Diff line number Diff line change
@@ -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 &
Expand All @@ -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
benchstat circl.txt kilic.txt > ../results/bls_comparison.txt

# Delete the temporary files
rm kilic.txt circl.txt
15 changes: 15 additions & 0 deletions benchmark/run.sh
Original file line number Diff line number Diff line change
@@ -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."
1 change: 1 addition & 0 deletions benchmark/try/benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "HELLO"

0 comments on commit ac2e53a

Please sign in to comment.