From 1af922b07410e82cd726a556cf77f56b17024ebd Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 20 Nov 2026 10:19:03 -0800 Subject: [PATCH 1/2] chore(quest): claim quest/m0/nightly/shared-bench-regressions.md Quest-Claim: 2c270cebe99ab6fc From 788939361738bf35791e969c848ef6ceb9f49531 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Fri, 20 Nov 2026 12:34:01 -0800 Subject: [PATCH 2/2] perf: a noop poll and an unrouted label cost what they did before 11-19 A blocked write polled with a noop waiter no longer inserts and removes a stream's waiter entry, and a presence readout omits an all-zero `routes`, which readers already default. Co-Authored-By: Claude Opus 5.5 --- doc/concept/stats.md | 3 +- js/stats/src/stats.test.ts | 2 ++ quest/m0/nightly/shared-bench-regressions.md | 29 -------------------- rs/kio/src/waiter.rs | 2 +- rs/moq-net/src/stats.rs | 18 ++++++++++++ rs/moq-net/src/stats/routes.rs | 5 ++++ rs/moq-quic/src/connection/waits.rs | 9 +++--- 7 files changed, 32 insertions(+), 36 deletions(-) delete mode 100644 quest/m0/nightly/shared-bench-regressions.md diff --git a/doc/concept/stats.md b/doc/concept/stats.md index 2247609f79a..bf7b6a6560b 100644 --- a/doc/concept/stats.md +++ b/doc/concept/stats.md @@ -448,7 +448,8 @@ release costs only that route. `routes` counts what the label's moq-lite-07 sessions did on the route layer, each under the label of the session whose peer caused it. Its size never -depends on how many broadcasts or relays the mesh has. When rolling a mesh onto +depends on how many broadcasts or relays the mesh has, and a label with nothing +counted leaves it out, which readers read as zeros. When rolling a mesh onto a new release one relay at a time, compare a canary's rates with its neighbours': diff --git a/js/stats/src/stats.test.ts b/js/stats/src/stats.test.ts index 41e13c6ebec..8a5ddc18668 100644 --- a/js/stats/src/stats.test.ts +++ b/js/stats/src/stats.test.ts @@ -121,6 +121,8 @@ test("a frame names each counter once and a missing counter reads zero", () => { expect(PresenceSchema.parse({ sessions_started: 4, sessions_ended: 2 })).toMatchObject({ sessions_started: 4, sessions_ended: 2, + // A label that never routed sends no `routes`. + routes: { changed: 0, closed: { other: 0 } }, }); // The pre-rename spellings are neither read nor kept. expect(PresenceSchema.parse({ sessions: 4, sessions_closed: 2 })).toMatchObject({ diff --git a/quest/m0/nightly/shared-bench-regressions.md b/quest/m0/nightly/shared-bench-regressions.md deleted file mode 100644 index 61090cd546a..00000000000 --- a/quest/m0/nightly/shared-bench-regressions.md +++ /dev/null @@ -1,29 +0,0 @@ -# [M] The 2026-11-19 shared-bench regressions are fixed or accepted - -## Goal - -Nightly's Rust shared bench targets pass the paired comparison again: each -regression from 2026-11-19 is fixed, or accepted by the PR that caused it -with a stated reason. - -## Plan - -Found by the 2026-11-19 triage of run [44562804083](https://github.com/moq-dev/moq/actions/runs/44562804083), -against the 2026-11-18 head (`4f3ba3317`). Twelve regressions, consistent -across all three rounds: - -- `connection_blocked/*/churn_*` +22 to 33%. Suspect - [moq-dev/moq#9152](https://github.com/moq-dev/moq/pull/9152), which also - changed that bench; check whether the bench now measures more, which is - not a regression. -- `stats/presence/*` +38 to 56%. Suspect - [moq-dev/moq#9054](https://github.com/moq-dev/moq/pull/9054), which adds - `poll_refresh` per tick. -- `relay_auth_refresh/1/1` +11.3%. - -Confirm each suspect with a paired local run of the bench at its PR and its -parent before changing code. - -Caused by: the suspects above, once confirmed. - -Public API: none expected. Wire: none. diff --git a/rs/kio/src/waiter.rs b/rs/kio/src/waiter.rs index 6c8d8a7a850..8f88330799e 100644 --- a/rs/kio/src/waiter.rs +++ b/rs/kio/src/waiter.rs @@ -75,7 +75,7 @@ impl Waiter { /// Whether this is a [`noop`](Self::noop) waiter. #[inline] - pub(crate) fn is_noop(&self) -> bool { + pub fn is_noop(&self) -> bool { self.noop } diff --git a/rs/moq-net/src/stats.rs b/rs/moq-net/src/stats.rs index 86b1600da9a..5f08713fb65 100644 --- a/rs/moq-net/src/stats.rs +++ b/rs/moq-net/src/stats.rs @@ -611,6 +611,8 @@ pub struct Presence { /// [`Routes::refused`]. pub routes_refused: u64, /// What the label's lite-07 sessions did on the route layer. + // Most labels never route, so an all-zero readout stays off the wire; readers default it. + #[serde(skip_serializing_if = "Routes::is_zero")] pub routes: Routes, } @@ -2319,6 +2321,22 @@ mod tests { assert_eq!(output["wire_rx"], 29); } + /// A label that never routed writes no `routes` and reads back as zeros, and one count + /// writes the whole readout. + #[test] + fn presence_routes_stay_off_the_wire_until_counted() { + let mut presence = Presence::default(); + let output = serde_json::to_value(presence).unwrap(); + assert!(output.get("routes").is_none(), "{output}"); + assert_eq!(serde_json::from_value::(output).unwrap(), presence); + + presence.routes.closed.other = 1; + let output = serde_json::to_value(presence).unwrap(); + assert_eq!(output["routes"]["closed"]["other"], 1); + assert_eq!(output["routes"]["changed"], 0); + assert_eq!(serde_json::from_value::(output).unwrap(), presence); + } + #[test] fn outcomes_survive_clones_tier_changes_and_pruning() { let stats = test_stats(); diff --git a/rs/moq-net/src/stats/routes.rs b/rs/moq-net/src/stats/routes.rs index 360a8afb7b7..b5f2a49404a 100644 --- a/rs/moq-net/src/stats/routes.rs +++ b/rs/moq-net/src/stats/routes.rs @@ -171,6 +171,11 @@ pub struct Routes { } impl Routes { + /// Whether nothing has been counted. + pub(crate) fn is_zero(&self) -> bool { + *self == Self::default() + } + /// Add every counter from another readout. pub fn add(&mut self, other: Self) { self.changed += other.changed; diff --git a/rs/moq-quic/src/connection/waits.rs b/rs/moq-quic/src/connection/waits.rs index c9f3b7027bc..20701dae6d8 100644 --- a/rs/moq-quic/src/connection/waits.rs +++ b/rs/moq-quic/src/connection/waits.rs @@ -89,12 +89,11 @@ pub(crate) struct Waits { impl Waits { /// Register `waiter` for `wait` on stream `id` pub(crate) fn register(&mut self, id: StreamId, wait: Wait, waiter: &Waiter) { - let waits = self.streams.entry(id).or_default(); - waiter.register(waits.list(wait)); - // A no-op waiter registers nothing, so a poll for the answer alone keeps no entry. - if waits.is_empty() { - self.streams.remove(&id); + // A no-op waiter registers nothing, so a poll for the answer alone costs no entry. + if waiter.is_noop() { + return; } + waiter.register(self.streams.entry(id).or_default().list(wait)); } /// Wake the waiters for `wait` on stream `id`