Repository navigation
fix(qmux): split records into frames without copying the rest - #6381
Conversation
Quest-Claim: 9bf3a44c88f266e9
`take` copied both the payload it split off and the rest of the record, so decoding a record of N frames copied O(N x record) bytes: one 16 KB record of empty STREAM frames copied about 60 MB before dispatch. Split with views, and copy a STREAM or DATAGRAM payload once where the session retains it, so a tiny frame never pins the record it arrived in. The single-frame decoder now reuses the record decoder instead of repeating every frame type. Adds `just js qmux-record-bench`, run nightly: record size x frames per record, including empty STREAM and MAX_DATA frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EeyiEy5FWz3z44DYZVo7vU
06f61a3 to
64b3625
Compare
|
Outcome: the quest is complete and its file is deleted. Record decoding is now linear in record size, with no open decisions, so this is ready for review. (Written by Claude Opus 5.5) |
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. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64b362501e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The legacy webtransport decoder now splits its frame type off with a view, so its STREAM payload aliased the WebSocket message. Copy it at the same retention boundary as the record path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EeyiEy5FWz3z44DYZVo7vU
|
@codex review (Written by Claude Opus 5.5) |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # js/justfile # quest/m1/release-audit/README.md # quest/m1/release-audit/qmux-copy.md # sh/gh/nightly.sh
|
@codex review (Written by Claude Opus 5.5) |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Merge summary:
(Written by Claude Opus 5.5) |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
The QMux WebSocket receive loop decodes each record with
decodeRecord(js/qmux/src/frame.ts). Itstakehelper copied both the payload it split off and the rest of the record, at every length-prefixed frame. A record of N frames therefore copied O(N x record size) bytes. A legal 16,380-byte record of empty STREAM frames copied about 60 MB before dispatch. Completes Parse QMux records without copying suffixes.Approach
takereturns views (subarray) for both halves, so walking a record copies nothing. Transport parameters split the same way.own) where the session keeps it. A view would pin the whole record behind a tiny frame, against flow control that counts only the frame. The no-length forms, which used to hand out a view of the record, are copied too.decodeQMux(one frame per message, draft-00) had a second copy of every frame type. It now callsdecodeQMuxOne, which removes about 130 lines.Measurements
New
just js qmux-record-bench, added to the nightly JS group. Each row is µs per record:What remains is per frame: BigInt varints and frame objects. It no longer grows with the record.
Impact
decodeanddecodeRecordkeep their signatures and output.Validation
frame.test.tscount the bytesUint8Array.prototype.slicecopies. Decoding 5,460 empty STREAM frames copies 0 bytes (59,612,280 onmain), and 400 32-byte payloads copy exactly 12,800. A retained payload does not alias its record, and a truncated length is still refused.bun testinjs/qmux: 202 pass.just check: everything passes except one@moq/hangtest,the fallback decodes AAC without a native AudioDecoder. It fails onmainfrom a test-order collision introduced today and is fixed in moq-dev/moq#6382.🤖 Generated with Claude Code
https://claude.ai/code/session_01EeyiEy5FWz3z44DYZVo7vU
(Written by Claude Opus 5.5)