diff options
Diffstat (limited to 'benchmarks/comparison/README.md')
| -rw-r--r-- | benchmarks/comparison/README.md | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/benchmarks/comparison/README.md b/benchmarks/comparison/README.md new file mode 100644 index 0000000..1b97429 --- /dev/null +++ b/benchmarks/comparison/README.md | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | # Nostr Library Comparison Benchmarks | ||
| 2 | |||
| 3 | This module contains benchmarks comparing `code.northwest.io/nostr` with other popular Go Nostr libraries: | ||
| 4 | |||
| 5 | - **NWIO** (`code.northwest.io/nostr`) - This library | ||
| 6 | - **NBD** (`github.com/nbd-wtf/go-nostr`) - Popular community library | ||
| 7 | - **Fiat** (`fiatjaf.com/nostr`) - Original implementation by Fiatjaf | ||
| 8 | |||
| 9 | ## Why a Separate Module? | ||
| 10 | |||
| 11 | The comparison libraries are isolated in this separate Go module to keep the main `code.northwest.io/nostr` package clean. Users who import the main package won't have `fiatjaf.com/nostr` or `github.com/nbd-wtf/go-nostr` pulled into their dependency tree. | ||
| 12 | |||
| 13 | ## Running Benchmarks | ||
| 14 | |||
| 15 | From this directory: | ||
| 16 | |||
| 17 | ```bash | ||
| 18 | # Run all comparison benchmarks | ||
| 19 | go test -bench=. -benchmem | ||
| 20 | |||
| 21 | # Run specific benchmarks | ||
| 22 | go test -bench=BenchmarkEventSign -benchmem | ||
| 23 | |||
| 24 | # Compare NWIO vs NBD | ||
| 25 | go test -bench='.*_(NWIO|NBD)' -benchmem | ||
| 26 | ``` | ||
| 27 | |||
| 28 | From the project root: | ||
| 29 | |||
| 30 | ```bash | ||
| 31 | cd benchmarks/comparison | ||
| 32 | go test -bench=. -benchmem | ||
| 33 | ``` | ||
| 34 | |||
| 35 | ## Benchmark Categories | ||
| 36 | |||
| 37 | - **Event Unmarshaling/Marshaling**: JSON parsing and serialization | ||
| 38 | - **Event Serialization**: Canonical serialization for ID computation | ||
| 39 | - **Event ID Computation**: Computing event ID hashes | ||
| 40 | - **Key Generation**: Generating new private keys | ||
| 41 | - **Event Signing/Verification**: Cryptographic operations | ||
| 42 | - **Filter Matching**: Simple and complex filter matching | ||
| 43 | |||
| 44 | See [../../BENCHMARKS.md](../../BENCHMARKS.md) for detailed documentation. | ||
