p256 PR draft ready for ReSpeak/tsclientlib submission. Performance benchmarks document with tsclientlib baselines and Chanora current metrics. Web client assessed as infeasible without UDP proxy infrastructure.
2.4 KiB
2.4 KiB
Performance Benchmarks
Date: 2026-06-11 Purpose: Track performance baselines for Chanora and reference benchmarks from upstream projects.
1. Upstream Reference: tsclientlib (ReSpeak)
Source: docs/references/respeak-protocol-reference.md §10
Hardware: i7-5280K, 6 cores/12 threads @ 3.6 GHz (single thread)
| Metric | Value | Notes |
|---|---|---|
| Connection time | ~199 ms | RSA puzzle solving is dominant bottleneck |
| Message send | ~189 µs | 5,300 messages/sec |
| Connections/sec | ~6.5 | Limited by RSA puzzle |
2. Chanora Current Benchmarks
Source: current.json (2026-06-09, x86_64-unknown-linux-gnu, rustc 1.95.0)
| Metric | Value | Unit |
|---|---|---|
| Opus encode latency | ~70 µs | 70,216 ns |
| Opus decode latency | ~16 µs | 15,873 ns |
| Resampler 44.1kHz→48kHz | TBD | samples/sec |
| Resampler 16kHz→48kHz | TBD | samples/sec |
| Resampler 48kHz passthrough | TBD | samples/sec |
| Capture alloc count | TBD | blocks |
| Capture callback wall clock | TBD | ns |
3. Target Benchmarks
| Metric | Target | Rationale |
|---|---|---|
| Opus encode | < 100 µs | Must fit within 10ms frame budget with headroom |
| Opus decode | < 25 µs | Must handle multi-user mixing (N decodes per frame) |
| Connection time | < 500 ms | User-perceived latency for server join |
| Message round-trip | < 500 µs | Command acknowledgement within 1 frame |
| Audio pipeline (capture→encode→send) | < 5 ms | Real-time constraint for 10ms Opus frames |
| Audio pipeline (receive→decode→mix→play) | < 5 ms | Real-time constraint |
| Reconnect time | < 3 s | Including exponential backoff first retry (1s) |
4. Benchmark Methodology
Audio Latency
- Measured via
criterionbenchmarks inchanora_audio - Single-threaded, no contention
- Represents encode/decode only (excludes I/O)
Connection Time
- Measured from
connect()call to firstConnectedevent - Includes: DNS resolution, TCP, Init1-5 handshake, ECDH, auth
- RSA puzzle (~199ms) dominates
Message Throughput
- Measured for command send path only (no network I/O)
- Includes serialization + encryption
5. Notes
- tsclientlib benchmarks are from 2019-era hardware; modern CPUs ~4x faster for RSA
- Chanora's Opus benchmarks are production-quality (well under 10ms frame budget)
- Multi-user mixing performance not yet benchmarked (critical for large channels)