diff --git a/bench.sh b/bench.sh index e7a2b8d..c90013f 100644 --- a/bench.sh +++ b/bench.sh @@ -11,19 +11,28 @@ for version in "${versions[@]}"; do echo "Checking out version: $version" git checkout $version + # Check if ouroboros_test.go exists + if [ -f ./ouroboros_test.go ]; then + test_cmd="go test -run='^$' -bench=. -count=6" + else + test_cmd="go test ./test -run='^$' -bench=. -count=6" + fi + echo "Running benchmarks for version: $version" - go test -run='^$' -bench=. -count=6 > "benchmarks/${version}" + eval "$test_cmd" > "benchmarks/${version}.txt" done # Checkout the main branch again git checkout main # Generate the benchstat comparison command with all the .txt files -benchstat_cmd="benchstat " +benchstat_cmd="benchstat" for version in "${versions[@]}"; do - benchstat_cmd+=" benchmarks/${version}" + benchstat_cmd+=" benchmarks/${version}.txt" done # Execute the comparison command and save it as a CSV echo "Comparing all versions with benchstat..." -eval "$benchstat_cmd" > "benchmarks/combined_benchmarks_comparison" +eval "$benchstat_cmd" > "benchmarks/combined_benchmarks_comparison.csv" + +echo "Benchmarking and comparison completed."