diff options
| author | Clawd <ai@clawd.bot> | 2026-02-16 12:12:37 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-16 12:12:37 -0800 |
| commit | 9d20d2281f4698024b7be67d1b86178b4e8e2484 (patch) | |
| tree | f72986f33904afc36b72dd8bbb7d83802fee0479 /benchmarks/run_benchmarks.sh | |
| parent | 4b7dfe1e7764d8424b1be935c7fea09a102382e8 (diff) | |
Clean up project structure
- Add README.md
- Move benchmark files to benchmarks/
- Move PLAN.md to .claude/
- Add .gitignore
Diffstat (limited to 'benchmarks/run_benchmarks.sh')
| -rwxr-xr-x | benchmarks/run_benchmarks.sh | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | set -e | ||
| 3 | |||
| 4 | # Colors for output | ||
| 5 | GREEN='\033[0;32m' | ||
| 6 | BLUE='\033[0;34m' | ||
| 7 | YELLOW='\033[1;33m' | ||
| 8 | NC='\033[0m' # No Color | ||
| 9 | |||
| 10 | echo -e "${BLUE}Running Nostr Library Benchmarks${NC}" | ||
| 11 | echo -e "${BLUE}Comparing: NWIO vs NBD-WTF vs Fiatjaf${NC}" | ||
| 12 | echo "" | ||
| 13 | |||
| 14 | # First, install comparison dependencies if needed | ||
| 15 | echo -e "${YELLOW}Ensuring comparison dependencies are available...${NC}" | ||
| 16 | go get -tags=benchcmp -t ./... | ||
| 17 | echo "" | ||
| 18 | |||
| 19 | # Run all benchmarks with the benchcmp build tag | ||
| 20 | echo -e "${GREEN}Running all benchmarks...${NC}" | ||
| 21 | go test -tags=benchcmp -bench=. -benchmem -benchtime=1s -run=^$ | tee benchmark_results.txt | ||
| 22 | |||
| 23 | echo "" | ||
| 24 | echo -e "${GREEN}Results saved to benchmark_results.txt${NC}" | ||
| 25 | echo "" | ||
| 26 | echo -e "${BLUE}To run specific benchmark groups:${NC}" | ||
| 27 | echo " go test -tags=benchcmp -bench=BenchmarkEventUnmarshal -benchmem" | ||
| 28 | echo " go test -tags=benchcmp -bench=BenchmarkEventSign -benchmem" | ||
| 29 | echo " go test -tags=benchcmp -bench=BenchmarkEventVerify -benchmem" | ||
| 30 | echo " go test -tags=benchcmp -bench=BenchmarkFilterMatch -benchmem" | ||
| 31 | echo "" | ||
| 32 | echo -e "${BLUE}To compare specific libraries:${NC}" | ||
| 33 | echo " go test -tags=benchcmp -bench='.*_NWIO' -benchmem" | ||
| 34 | echo " go test -tags=benchcmp -bench='.*_NBD' -benchmem" | ||
| 35 | echo " go test -tags=benchcmp -bench='.*_Fiat' -benchmem" | ||
