Repository navigation
Description
Found by job 050's approver at c6969d3e (PR #1381), where the performance lens was stood down with a reason that turned out to be wrong ("the per-frame work is a 32-byte prefix scan with no allocation").
MessageClass::from_frame (crates/nostream-relay/src/limits.rs:104-111) builds a String for every classified frame — an upper-cased copy of a ≤8-byte word — on the path every inbound frame takes before messages::decode.
Acceptance: the frame's class is derived without allocating (eq_ignore_ascii_case against the eight tokens, or a match on [u8]), with the existing parser cases unchanged and one case added for a frame whose prefix is not ASCII. The measured effect stated: one allocation per inbound frame removed; a before/after count from the existing relay socket harness is enough, no new bench.
For whoever picks this up
- What is wrong:
MessageClass::from_framecopies the quoted leading word of every inbound text frame into a heapString(String::newpluspush) just to compare it with eight known message names, so each frame that reaches a quoted word pays one allocation before the message is decoded or handled. - Done looks like: the class is derived from a stack buffer or with
eq_ignore_ascii_caseandfrom_frameperforms no heap allocation, whilethe_message_class_is_read_from_the_frame_prefixincrates/nostream-relay/tests/limits.rskeeps every existing case and gains one non-ASCII prefix case (["RÉQ"]isOther). The crate has no allocation-counting harness today, so the observing test is new:crates/nostream-relay/tests/frame_alloc.rs, its own test binary with a counting#[global_allocator], whosefrom_frame_does_not_allocateasserts the count is unchanged acrossMessageClass::from_framefor all eight class tokens plus anOtherframe; it fails before the fix with one allocation per call. - Where it lives:
crates/nostream-relay/src/limits.rs,MessageClass::from_frame, called for every inbound text frame fromRelay::on_client_messageincrates/nostream-relay/src/relay.rs. - Intent: [Rewrite P6] Hardening: fuzz, benchmark gate, 72h soak, security review #868 explains why the cost matters: its six-lens review and benchmark gate measure the relay before cutover, and this is a per-frame cost on the path every inbound message takes.
Activity
chappie-daemon commentedon Dec 6, 2026
Delivery date: Friday 2026-12-18.
A PR that is green and ready for review by then keeps this row yours. If nothing is up by Monday 2026-12-21 we take the row back into our own queue, because the v4 cutover on 2026-12-31 cannot wait on it.
Your PR #1395 is already up, approved and clean, so this is a checkpoint rather than a start.
If that date does not work, say so here and we will set one — a stated date is only useful if it is one you can meet.