Skip to content

perf(net): keep the IETF message parameter codec out of the first load; checkpoint the m1 size audit - #6172

Merged
kixelated merged 3 commits into
mainfrom
quest/m1/audit-size
Oct 21, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m1/audit-size

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Checkpoint for quest/m1/audit-size.md, the m1 run of the artifact size audit, a day after the m0 run finished in moq-dev/moq#6101.

Problem

@moq/net's eager SETUP surface still pulled in the IETF message parameter codec: SetupOptions shared ietf/parameters.ts with the request Parameters (and through it filter.ts), cluster.ts built Parameters blocks, and initialMaxRequestId lived in request.ts. A lite session never uses any of it.

Approach

  • SetupOption, SetupOptions, REQUEST_WINDOW and initialMaxRequestId move to ietf/setup_options.ts.
  • Cluster.intoParams/updateIntoParams fill a caller's Parameters instead of constructing one, so cluster.ts imports Parameters as a type only.
  • ietf/index.test.ts now also fails if the entry statically reaches ietf/parameters.ts (verified failing with a stray import in setup.ts).

First load, gzip, from sh/size/bundles.ts, main 7d2a91f -> this PR:

Bundle main this PR
net 101.2 KB 95.7 KB (-5.4%)
watch 161.8 KB 156.7 KB
watch-ui 174.3 KB 169.2 KB
publish 151.7 KB 146.5 KB

Audit results (recorded in the quest)

Rebuilt both 2b28f5e (the m0 baseline) and 7d2a91f locally with the same method:

Artifact 2b28f5e 7d2a91f
moq-relay 31.31 MiB 31.81 MiB
moq CLI 47.54 MiB 48.45 MiB
libmoq_ffi.so 34.16 MiB 34.80 MiB
moq_bg.wasm gzip 771.0 KB 861.9 KB
  • Native growth is moq-net features (ranges and time anchors, TRACKS, followed instances, compressed tracks), +0.41 to 0.53 MiB of text per binary, plus CLI import stats and the catalog diff serializer. WASM code grew 187 KB raw, 55 KB of it zlib-rs for compressed tracks. Explained, no action.
  • moq-net compiles once (in progress): moq-net is 9.5 MiB of the relay's text and 7.7 MiB of the FFI library's, about 2.5 MiB with one copy per function. The relay's 16-line binary crate alone instantiates 3.1 MiB of it. Linker ICF (-Wl,--icf=all) saves only 0.23 MiB, because the per-crate copies differ after LTO.
  • pako is 12.8 KB gzip of watch and publish; the lead goes into compressed tracks in js/net, which will move it into every first load.
  • Nightly sizes is still skipped: the Linux release builds fail to link until moq-dev/moq#6090 lands.
  • The m0 run's main figures for the FFI library (31.86 MiB) and CLI (48.14 MiB) do not reproduce from 2b28f5e. The quest now records the same-method rebuild.

Choice made without asking

This run is checkpointed, not finished: the m1 quest now requires net-erase-transport. If it finished now, the successor would wait in m2 for the release cut, and nothing would audit the rest of m1 (the erasure result, pako moving into @moq/net) before the breaking release. To finish it now instead, drop the Required entry and move the successor to m2.

Impact

  • Public API: none. ietf/* is internal, and @moq/net's exports are unchanged.
  • Wire: none.

Checks

  • just check (scoped): passed
  • quest check: passed
  • bun test for js/net IETF and connection: 922 pass

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 3 commits October 20, 2026 23:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SETUP options move from ietf/parameters.ts to ietf/setup_options.ts, with the
MAX_REQUEST_ID window from ietf/request.ts, and the MoQ Cluster helpers fill a
caller's parameter block instead of constructing one. The eager SETUP surface
no longer reaches the message parameter codec or the filter module, which only
a session uses. First load drops about 5.1 to 5.5 KB gzip in every consumer
bundle; ietf/index.test.ts fails if SETUP reaches parameters.ts again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-measures native, WASM and JS sizes against the m0 baseline commit, records
the transport erasure ceiling for net-erase-transport, carries the pako lead
into the js/net compressed tracks quest, and blocks the run's finish on
net-erase-transport so the audit before the breaking cut sees its result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 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 20 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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4c909acd-e43b-4ecc-8474-7ea9c1cdf758
📥 Commits

Reviewing files that changed from the base of the PR and between 7d2a91f and 6913dc5.

📒 Files selected for processing: 28
  • js/net/src/ietf/active_count.ts
  • js/net/src/ietf/adapter.test.ts
  • js/net/src/ietf/adapter.ts
  • js/net/src/ietf/auth.test.ts
  • js/net/src/ietf/auth_setup.ts
  • js/net/src/ietf/cluster.test.ts
  • js/net/src/ietf/cluster.ts
  • js/net/src/ietf/connection.test.ts
  • js/net/src/ietf/epoch.test.ts
  • js/net/src/ietf/epoch.ts
  • js/net/src/ietf/hidden.ts
  • js/net/src/ietf/ietf.test.ts
  • js/net/src/ietf/index.test.ts
  • js/net/src/ietf/index.ts
  • js/net/src/ietf/malformed.test.ts
  • js/net/src/ietf/max-age.test.ts
  • js/net/src/ietf/max_age.ts
  • js/net/src/ietf/parameters.ts
  • js/net/src/ietf/publish_namespace.ts
  • js/net/src/ietf/request.ts
  • js/net/src/ietf/setup.ts
  • js/net/src/ietf/setup_options.ts
  • js/net/src/ietf/solicit.test.ts
  • js/net/src/ietf/solicit.ts
  • js/net/src/ietf/token.test.ts
  • js/net/src/ietf/token.ts
  • quest/m1/audit-size.md
  • quest/m1/compress/js.md
  • 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 21, 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-21T07:36:09.606991Z 6913dc5 PR opened
ℹ️ 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.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Outcome: the m1 size audit is checkpointed. One fix: @moq/net's SETUP surface no longer loads the IETF message parameter codec, saving 5.1 to 5.5 KB gzip in every first load. Native and WASM growth since the m0 baseline is moq-net features plus zlib-rs for compressed tracks, all explained. The audit finishes after moq-net compiles once lands, so the run before the breaking cut sees its result. The pako lead goes into the js/net compressed tracks quest.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit 6e6a6be Oct 21, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m1/audit-size branch October 21, 2026 14:39
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