Repository navigation
feat(ts): time a frame split across reads in the bench - #42
Conversation
Quest-Claim: 3ec14568ec37aaa8
Adds a decode of the video frame headers as they arrive 3 bytes at a time, so every header comes up Short at least once and is decoded again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0115AT2ue6x9cT5e5J9SZtCn
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 3fed326
No actionable bugs found. The benchmark-only direction is sound: retries preserve the incomplete header's start, commit counters only after successful decoding, and include short-decode counts in the existing cross-route output comparison. Two fixed 3-byte workloads exercise both wire formats without unnecessary production complexity.
This agrees with the independent exact-head summary: #42 (comment). Static inspection only; I did not run tests or benchmarks or reproduce reported performance figures.
|
Merging. Since the review, the only change is a merge of origin/main (#36 MIR spike, #41 exporter spike), with no conflicts and no snapshot change.
(written by Opus 5.5) |
Problem
Every
just ts benchworkload decodes a complete buffer, so no error path is priced. #15 left "?returns the incomingErr" undone for that reason.Approach
bench.rsop 7 (decode_split): the video frame headers arrive 3 bytes at a time. Each read decodes every header it completes; a header cut by a read comes upShortthrough?and is decoded again from its start on the next read. Output adds the count of short decodes, so every route must retry exactly as often as native Rust.workloads.tsaddsframes/video/lite-06/3B-readsandlite-07/3B-reads, 60 items each, so a row lines up with the whole-bufferframes/videodecode.moq.ts): aReaderover the bytes so far, drained withtryDecode. This is the subscriber's sync path. A stream-fedReaderwould also price a promise for each read.Numbers
ns per frame header, the median of 15 rounds. Run 2 is an A/B run with
--route reuse=: the same translation, edited by hand so every identity?returns the incomingErrobject (return xin place ofreturn rt.Err(x.error), at 10 files' sites). Host: Ryzen 9 5900XT, 32 threads, shared. Load average was 25 at the start and 12 at the end. A/A noise at the median workload: Node 1.8%, Bun 5.0%, Chrome 2.9%.Shortis a thrown value. On this path the translation is 0.5-0.8x hand-written.?reusing the incomingErrmakes a difference of -9% to +6%. The A/A differences on the same rows run from -5% to +13%. Node is the only hint: 6-8% faster on both rows, against A/A's 3-5%. Bun and Chrome are within noise. That is too little to justify the change on a path a real stream rarely takes.Impact
bench.tssnapshot gainsdecodeSplitandframeHeader.Alternatives
ReadableStreamwithawait decode: this adds a promise per read, which is not the error path.Follow-ups
?result above does not justify the optimization; rerun this A/B if the error path ever matters more.🤖 Generated with Claude Code
https://claude.ai/code/session_0115AT2ue6x9cT5e5J9SZtCn
(written by Opus 5.5)