feat: add replay/parser performance guardrails - #259
Conversation
Bench comparisonRuntime:
Regressions (>5%)
Replay/parser benchmark budgetsBase commit has no replay/parser benchmark. Current hard memory budgets passed; same-machine throughput comparison starts after this benchmark lands on the base branch. |
Snazzie
left a comment
There was a problem hiding this comment.
Request changes: This benchmark should not include SQLite or raw file I/O in its measured path; those make results non-reproducible. Please move the parser and semantic replay work into the existing Mitata harness using preloaded deterministic inputs:
- raw lap-frame parsing
- semantic resolver/canonical envelope transformation
Keep frame-count assertions, but replace custom report/comparison logic with Mitata JSON output and the existing benchmark comparator. Also fix or remove custom RSS measurements: current macOS output reports hundreds of GiB because maxRSS is multiplied by 1024 despite already being bytes.
|
Additional issue: the custom worker performs one timed run per scenario with no warmup or repeated samples. Mitata should own warmup/sampling so comparison uses stable statistics (median/p99 and variance/tolerance), rather than a single cold-process measurement. |
What changed
telemetry-benchmark-results.jsonas generated output instead of committed machine-specific dataWhy this helps
Single benchmark run gives capacity snapshot. Current parser processes 20,000 frames in roughly 0.4 seconds while exposing baseline, peak, and incremental memory use. Value compounds after this lands on
main: relevant PRs compare base and current revisions under same Bun version and machine.Guardrails catch:
RSS and heap are not added together. RSS measures resident process memory; heap measures Bun/JSC-managed memory. Incremental metrics subtract worker startup baseline to better isolate workload growth. This remains targeted parser/replay guardrail, not proof of UI latency, long-running leak behavior, every recording shape, or low-memory hardware behavior.
Budget policy
Verification
bun install --frozen-lockfilebun test test/tooling/replay-parser-bench-compare.test.ts— 5 passed, 20 assertionsbun run typecheckbun run lintbun run bench:telemetry:current --no-enforce --output=telemetry-benchmark-results.jsonbun run bench:telemetry --base=main