From 9d20d2281f4698024b7be67d1b86178b4e8e2484 Mon Sep 17 00:00:00 2001 From: Clawd Date: Mon, 16 Feb 2026 12:12:37 -0800 Subject: Clean up project structure - Add README.md - Move benchmark files to benchmarks/ - Move PLAN.md to .claude/ - Add .gitignore --- benchmarks/run_benchmarks.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 benchmarks/run_benchmarks.sh (limited to 'benchmarks/run_benchmarks.sh') diff --git a/benchmarks/run_benchmarks.sh b/benchmarks/run_benchmarks.sh new file mode 100755 index 0000000..87dfd17 --- /dev/null +++ b/benchmarks/run_benchmarks.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -e + +# Colors for output +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +echo -e "${BLUE}Running Nostr Library Benchmarks${NC}" +echo -e "${BLUE}Comparing: NWIO vs NBD-WTF vs Fiatjaf${NC}" +echo "" + +# First, install comparison dependencies if needed +echo -e "${YELLOW}Ensuring comparison dependencies are available...${NC}" +go get -tags=benchcmp -t ./... +echo "" + +# Run all benchmarks with the benchcmp build tag +echo -e "${GREEN}Running all benchmarks...${NC}" +go test -tags=benchcmp -bench=. -benchmem -benchtime=1s -run=^$ | tee benchmark_results.txt + +echo "" +echo -e "${GREEN}Results saved to benchmark_results.txt${NC}" +echo "" +echo -e "${BLUE}To run specific benchmark groups:${NC}" +echo " go test -tags=benchcmp -bench=BenchmarkEventUnmarshal -benchmem" +echo " go test -tags=benchcmp -bench=BenchmarkEventSign -benchmem" +echo " go test -tags=benchcmp -bench=BenchmarkEventVerify -benchmem" +echo " go test -tags=benchcmp -bench=BenchmarkFilterMatch -benchmem" +echo "" +echo -e "${BLUE}To compare specific libraries:${NC}" +echo " go test -tags=benchcmp -bench='.*_NWIO' -benchmem" +echo " go test -tags=benchcmp -bench='.*_NBD' -benchmem" +echo " go test -tags=benchcmp -bench='.*_Fiat' -benchmem" -- cgit v1.2.3