Skip to content

quest: finish the m0 compile-time audit - #6106

Merged
kixelated merged 7 commits into
mainfrom
quest/m0/audit-compile-time
Oct 21, 2026
Merged

kixelated merged 7 commits into
mainfrom
quest/m0/audit-compile-time

Conversation

@kixelated

@kixelated kixelated commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes the m0 run of the compile-time audit. It deletes quest/m0/audit-compile-time.md and adds the recurring successor, quest/m1/audit-compile-time.md, at the end of m1's Required. The successor's Plan holds the baselines, the results, and what to check first. No source changes.

Measured

All measurements are on d55407256 (main at 4576bb1 merged in), in the pinned shell with two jobs, on a shared host.

  • cargo llvm-lines, dev, deterministic. moq-tokio lib: 1.66M lines. 43.2% of that is moq-net code that is generic over the transport session, so it compiles once per transport and again under the IETF ControlStreamAdapter. Smaller targets: moq-cli bin 1.04M, moq-mux lib 0.91M, moq-relay lib 0.71M (28% serde from TOML config, 8.6% usage-rs derive), moq-net lib 0.69M, moq-relay bin 0.38M.
  • Release -Z time-passes on the moq binary. LLVM_fatlto takes 74%, LLVM_passes 23%, codegen_crate 1.7%, the frontend 0.9%, and link 0.3%. The final unit is all serial LLVM work on one fat-LTO module.
  • Net-edit just check. The probe is one comment line in moq-net. It selected 29 Rust packages, and the test build took 5m40s (524 mbx hits, 83 misses). The run then stopped on the known failover flake after 663 of 7,890 tests.

Load-sensitive numbers. Every time above depends on host load: the release build ran at load 21 to 89, time-passes at 25 to 52, and just check at 20 to 44, on 24 to 32 CPUs. The successor records the load next to each run. Compare pass and phase shares, not seconds. The llvm-lines counts are the only deterministic numbers.

Thin-LTO experiment

Thin was switched on with CARGO_PROFILE_RELEASE_LTO=thin; the profile is unchanged. Build: d55407256, x86_64 Linux host, two jobs.

(a) Size, deterministic, the deciding number.

Artifact Fat Thin Change
libmoq_ffi.a (Go mirror, --features openh264) 71.23 MiB 81.07 MiB +13.8%
libmoq_ffi.so 33.88 MiB 37.16 MiB +9.7%
moq CLI 48.62 MiB 52.93 MiB +9.0%

Both fit under the 100 MiB per-file limit. Thin cuts the headroom from 28.8 MiB to 18.9 MiB. Only x86_64 Linux was built. For the other targets, the mirror's v0.4.17 fat archives are 61.5 MiB (linux_arm64), 54.4 MiB (windows_amd64) and 40.5 MiB (darwin_arm64).

(b) Build time. Load averages were 20 to 51, so these are load-sensitive: compare ratios, not seconds.

Build Fat wall Thin wall Thin/fat wall Thin/fat CPU
Clean -p moq-ffi, both modes at once 544 s 469 s 0.86 1.00
Then -p moq-cli --bin moq, both modes at once 643 s 545 s 0.85 1.02
moq_ffi final unit, interleaved, two rounds with order swapped 226, 256 s 199, 158 s 0.74 1.11
moq final unit, interleaved, two rounds with order swapped 416, 404 s 246, 240 s 0.59 0.97

With two jobs, thin LTO's parallel backend gets only two threads, so more cores would save more wall time.

(c) Runtime. perf stat is blocked here (perf_event_paranoid is 4, and I did not change it). Instead, these are instruction counts from valgrind cachegrind on criterion --test, which runs each case once:

  • moq-net session_delivery_viewers (lite-06, lite-07, moq-transport-22): 2,621M fat, 2,677M thin (+2.1%).
  • track_fanout: 414M fat, 421M thin (+1.6%).
  • Repeats varied by at most 0.4%.

Not measured. Thin sizes for linux_arm64, darwin_arm64 and windows_amd64; build time above two jobs; wall-clock runtime. The host never went quiet, so no further timing runs were done.

Decisions

Recorded as the paper trail. The release profile was confirmed by the maintainer; the others took the recommended option.

  • Transport type erasure in moq-net
    • ✅ Defer to the existing moq-net compiles once quest. The size audit already planned it, with a relay fan-out benchmark gate. The compile-time evidence is recorded here.
    • Fold it into this PR: too large to review alongside an audit.
  • Release profile (fat LTO, one codegen unit): confirmed by the maintainer. The thin-LTO experiment above was run on request.
    • ✅ Keep fat, and revisit once moq-net compiles once shrinks the archive. Thin saves wall time only in nightly and release-PR builds, which are off the merge-queue gate. It spends 10 MiB of the Go archive's headroom under a hard publish limit while that archive is still growing, and costs about 2% more instructions.
    • Switch to lto = "thin" workspace-wide. Cargo refuses lto in per-package overrides, so it can't apply to the CLI alone. The final release unit's wall time drops by about 40%, and every artifact still fits.
  • Net-edit just check baseline
    • ✅ Record the compile phases from the failed run. Leave the green run to the flake quest. Test runtime belongs to the test cost audit.
    • Rerun until green: the target directory is now warm, so a rerun would not measure the same thing.

Checks

  • quest check: passed.
  • just check origin/main on the final diff (quest files only): passed at 84028acc3. At 43a2de5e8, everything passed except bench/relay.test.py, which failed twice on the foreign-listener port-collision flake. moq-dev/moq#6121 fixes that flake.
  • just check with the moq-net probe: failed on the known flake. That run was a measurement only, and the probe is reverted.

Follow-ups

These go through /quest-plan.

  • Add compile time to the Goal of moq-net compiles once, so its PR re-measures moq-tokio's llvm-lines.
  • Upstream to kixelated/mp4-atom: Any::decode_atom is instantiated for four reader types, 38k lines and 4.2% of moq-mux. The successor lists this as a candidate.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

kixelated and others added 4 commits October 20, 2026 15:25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Records llvm-lines for moq-tokio, moq-net, moq-mux, moq-relay and the moq
CLI, release -Z time-passes attribution for the moq binary, and a net-edit
`just check` baseline. The largest attributable cost, moq-net monomorphized
per transport, is already planned in quest/m1/net-erase-transport.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title wip(quest): compile-time audit measurements quest: finish the m0 compile-time audit Oct 21, 2026
kixelated and others added 3 commits October 20, 2026 21:23
Thin LTO grows libmoq_ffi.a 13.8% (71.2 to 81.1 MiB of the Go mirror's
100 MiB limit), costs about 2% more instructions on moq-net benches, and
cuts the final release unit's wall time by about 40% on two jobs. The
profile stays fat pending the maintainer's decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review October 21, 2026 04:35
@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 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
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee428e9c-a4c2-468e-a335-62cb66788a45
📥 Commits

Reviewing files that changed from the base of the PR and between 4327505 and 3a3e59f.

📒 Files selected for processing: 4
  • quest/m0/README.md
  • quest/m0/audit-compile-time.md
  • quest/m1/README.md
  • quest/m1/audit-compile-time.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-21T04:40:45.664523Z 3a3e59f Draft marked ready
ℹ️ 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
kixelated added this pull request to the merge queue Oct 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 21, 2026
@kixelated
kixelated added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit d20d2dd Oct 21, 2026
11 checks passed
@kixelated
kixelated deleted the quest/m0/audit-compile-time branch October 21, 2026 19:46
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