Skip to content

Commit b6cebab

Browse files
committed
add codec benches
1 parent 47b9f92 commit b6cebab

11 files changed

Lines changed: 3828 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sv2/codec-sv2/BENCHES.md

Lines changed: 1870 additions & 0 deletions
Large diffs are not rendered by default.

sv2/codec-sv2/Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ tracing = { workspace = true, optional = true }
2121

2222
[dev-dependencies]
2323
key-utils = { workspace = true }
24+
criterion = { workspace = true }
25+
rayon-core = { workspace = true }
2426
quickcheck = { workspace = true }
2527
quickcheck_macros = { workspace = true }
2628

@@ -32,3 +34,28 @@ tracing = ["dep:tracing"]
3234

3335
[package.metadata.docs.rs]
3436
features = ["with_buffer_pool", "noise_sv2", "std"]
37+
38+
39+
[[bench]]
40+
name = "encoder"
41+
harness = false
42+
43+
[[bench]]
44+
name = "decoder"
45+
harness = false
46+
47+
[[bench]]
48+
name = "noise_roundtrip"
49+
harness = false
50+
51+
[[bench]]
52+
name = "serialization"
53+
harness = false
54+
55+
[[bench]]
56+
name = "buffer_exhaustion"
57+
harness = false
58+
59+
[[bench]]
60+
name = "pool_lifecycle"
61+
harness = false

sv2/codec-sv2/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,24 @@ This crate provides two examples demonstrating how to encode and decode Sv2 fram
4646
Encode and decode Sv2 frames with Noise protocol encryption, detailing the entire encryption
4747
handshake and transport phase and serialization and transmission process for encrypted
4848
communications.
49+
50+
## Benchmarks
51+
52+
Performance benchmarks are provided for all major code paths: plain encoding/decoding,
53+
Noise protocol encryption, serialization, and buffer pool exhaustion behavior.
54+
55+
See **[BENCHES.md](BENCHES.md)** for the full benchmark suite documentation, including:
56+
- How to run each suite and which feature flags are needed
57+
- Descriptions of every benchmark target
58+
- Measured results with and without `with_buffer_pool` / `noise_sv2`
59+
- Analysis of buffer pool exhaustion thresholds and Alloc-mode overhead
60+
61+
Quick start:
62+
63+
```bash
64+
# Run all benchmarks with all features
65+
cargo bench --all-features
66+
67+
# Run only the pool exhaustion benchmarks
68+
cargo bench --bench buffer_exhaustion
69+
```

0 commit comments

Comments
 (0)