Repository navigation
perf(moq-quic): decode a PADDING run as one frame - #7075
Conversation
Quest-Claim: 626c3cda0beab522
frame::Iter yielded one Frame::Padding per padding byte, so every padded packet cost about a thousand iterator steps. Consume the run in one step. QMux draft-00 still counts each PADDING byte as a frame, so its one-frame-per-message rule is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 23 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 |
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: aeff48a
No actionable bugs found in the changed code and relevant receive paths. Collapsing zero-byte runs is a focused optimization: the iterator preserves consumed-byte accounting, QUIC receive paths already skip padding, and QMux draft-00 still rejects multiple padding frames. The plain scan is simpler than chunked/vectorized parsing and avoids unnecessary complexity. The new iterator and draft-00 regression tests address the main semantic risks; the padded benchmark covers the intended workload.
Verification limits: static GitHub review only; I did not run tests or benchmarks or independently verify the reported performance numbers.
|
Merge summary for head
(Written by Claude Opus 5.5) |
|
Re-land summary for head
(Written by Claude Opus 5.5) |
Problem
quest/m0/ci/quic-padding.md, found by moq-dev/moq#6987's profile: moq-quic'sframe::Iteryielded oneFrame::Paddingper PADDING byte. A 1200-byte padded Initial became about a thousand iterator steps, each moving aFramethroughOption<Result<..>>and the receive loop. In debug builds those moves dominate packet receive.Change
frame::Iterconsumes a whole run of PADDING (consecutive0x00bytes) in one step and yields a singleFrame::Padding.next_with_sizereports the run's full length. The remaining per-byte work is one zero check per byte.FRAME_ENCODING_ERROR. Without this, the collapse would have silently started accepting it.wire_decodebench: apaddedcase (below).Padding stats
No stat counts PADDING.
FrameStats::recordignoresFrame::Padding(and every receive loop skips it before recording), so there is no field whose meaning could change. UDP byte counts are taken from datagrams, not frames. Nothing to keep or migrate.Measurement
Debug build of the
moq-quiclib tests,tests::characterize(handshake-heavy), single-threaded, frame pointers,perf record:Connection::handle_packet(inclusive)frame::Iter(inclusive)memmove(self)Packet receive CPU falls by a third. User CPU of that test group: 0.60 to 0.63 s on main, 0.53 to 0.55 s here (3 runs each). The whole
moq-quiclib suite: 10.8 to 11.2 s on main, 10.6 to 10.7 s here, since most of it is not handshakes.It matters in release too. The
wire_decodebench gains apaddedcase: one small DATAGRAM frame with PADDING filling the rest of a 1360-byte payload, as a padded Initial or MTU probe arrives.wire_decode/paddedpackets_64packets_1024That is about 11 µs of decode per padded packet on main, against about 0.4 µs now. For comparison,
frames_1(one DATAGRAM frame filling the packet) measures 12.7 µs and 212 µs.Impact
Frameandframe::Iterarepub(crate).Choices made without asking
matchin the mux receive loop.wire_decodebench with apaddedshape rather than adding a new bench target.positionscan. It still touches every byte (about 0.13 ns a byte in release); a chunked zero check would be faster but is not worth the extra code at these numbers.Follow-ups
None found.
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code