Skip to content

perf(net): skip empty cache deadline clock reads - #6291

Merged
kixelated merged 7 commits into
mainfrom
quest/m1/release-perf/gc-idle
Oct 23, 2026
Merged

kixelated merged 7 commits into
mainfrom
quest/m1/release-perf/gc-idle

Conversation

@kixelated

@kixelated kixelated commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Idle track GC pays for an ambient clock read and an atomic read-modify-write on every poll even when no wall deadline exists. The benchmark also constructed a fresh waiter every iteration, charging allocation work that real drivers reuse. Found by the release perf epic (track_gc/idle 11.6 ns on release vs 73.7 ns on main).

Approach

Reuse benchmark waiters and add advancing-time cases. Skip the wall clock when the deadline index is empty. Keep one effective wall sample per nonempty release pass, and replace wall_micros.fetch_max with a store under the existing clock mutex, which already clamps every writer's supplied time. Preserve replacement-driver registration, callback lock boundaries, and max(wall, pts) aging.

Current consumers are origin drivers and standalone cache-pool drivers.

The remaining ~8 ns over release is accepted and recorded in the epic's comparison table: it is the lock and driver registration that wall-clock aging (moq-dev/moq#5548) needs. This PR retires the Idle GC quest with quest rm.

Impact

  • No public API or wire changes; no ownership or aging changes.

Validation

  • just rs check-test -p moq-net after merging main: 3,004 passed, 11 skipped. Deterministic tests cover replacement-driver rearming and ambient, supplied-future, and backward time.
  • just check: Rust lint, quest (574 documents), and drill checks passed. The flake VM-image check fails on this host with unshare: write failed /proc/self/uid_map: Operation not permitted, unrelated to this change.
  • Criterion reused-waiter baseline versus final source, same host; 30 samples, 0.2 s warmup, 0.5 s measurement for confirmation. Costs remain flat across idle track counts. Existing wall-deadline sweeps also cover track and cached-group counts.
Tracks Idle before Idle after Sweep before Sweep after
1 36.7 ns 20.1 ns 132 ns 113 ns
64 36.8 ns 20.0 ns 4.84 us 4.83 us
1,024 36.9 ns 19.9 ns 75.6 us 76.7 us
16,384 36.9 ns 20.1 ns 1.37 ms 1.35 ms

Advancing-input idle cases move from 36.7-37.5 ns to 19.7-19.8 ns. Small sweep differences are reported rather than treated as improvements on this shared host.

Alternatives

An earliest-deadline atomic alone cannot prove that a replacement waiter is registered. Comparing only supplied time also misses ambient time reaching a parked deadline. Neither shortcut is used. A reusable lock-free notification primitive could remove the last ~8 ns, but is not worth its cost.

Follow-ups

None.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 2 commits October 22, 2026 01:32
Co-Authored-By: GPT-6 <noreply@openai.com>
@kixelated kixelated changed the title Idle GC perf(net): skip empty cache deadline clock reads Oct 22, 2026
kixelated and others added 3 commits October 22, 2026 14:26
Main added a frame budget argument while this branch was open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The remaining ~8 ns over release pays for wall-clock aging (#5548). An
earliest-deadline atomic cannot prove a replacement driver is registered, and
a new notification primitive is not worth ~8 ns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review October 22, 2026 21:35
@kixelated

Copy link
Copy Markdown
Collaborator Author

@codex review

(Written by Claude Opus 5.5)

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5ebf9609-3e45-46ba-a282-7b60595228de
📥 Commits

Reviewing files that changed from the base of the PR and between 34b6ceb and ab196cc.

📒 Files selected for processing: 5
  • quest/m1/release-perf/README.md
  • quest/m1/release-perf/gc-idle.md
  • quest/m2/performance-survey/cache-metadata.md
  • rs/moq-net/benches/track.rs
  • rs/moq-net/src/model/cache.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T23:18:53.302915Z ab196cc New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 56943a1dd0

ℹ️ 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".

@kixelated
kixelated added this pull request to the merge queue Oct 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 22, 2026
kixelated and others added 2 commits October 22, 2026 16:14
# Conflicts:
#	quest/m1/release-perf/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 642b021 Oct 23, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m1/release-perf/gc-idle branch October 23, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant