Repository navigation
chore(quest): report that a subset compiler would not beat rustc on moq - #615
Conversation
Quest-Claim: 5a5d15a7fcc173d2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou'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 38 minutes. View limit details
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. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed head 8bbd21449c32ef5538be76c22b369804dc9c27b9 against base 91a905c94899792e4edade5f89dafa84e16c5034.
No actionable code findings in this three-file planning-only change. The subset-compiler quest is removed from m4's Required list, its closing rationale links to this report, and the root summary now names the existing rustc/cargo fork quest. The report addresses the deleted quest's requested subset, clean-build/edit estimates, and interoperability boundary. No compiler implementation, build configuration or public API changes are included.
Direction: recording the negative result and keeping future fork work evidence-gated is consistent with m4's stated purpose. Minor documentation suggestion: qualify the README's 'cuts a clean build by 16%' as retired instructions, and the sub-half-second ra-jit result as the successful body-edit cases. The report distinguishes these from wall time and the edit-async fallback; keeping those qualifications beside the short summary would prevent overgeneralizing the result.
Verification limits: GitHub-only static review of the complete diff, report and surrounding m4 plan/fork quest. I did not run quest context or validation, reproduce the benchmarks, inspect raw measurement artifacts, or independently establish the numerical estimates or claimed CI success. This is a review of the recorded plan, not experimental validation or merge approval.
…d edits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Problem
quest/m4/subset-compiler.md asks for a report: could a compiler for a stricter Rust subset (poll-first libraries with no
async fnbodies, thin generics, few proc macros) build moq faster than rustc does, now that moq follows those rules? Its prerequisites have landed: moq's poll-first epic closed in moq-dev/moq#7607, and the thin-generics rule is recorded in moq'squest/m0/ci/README.md.A maintainer's hint added a hypothesis to test: much of rustc's slowness is LLVM. So this report splits rustc's time between frontend and LLVM, measures how much LLVM IR each crate emits and why, and asks how much of a subset compiler's win Cranelift, thinner generics, or less IR could take instead.
Approach
Everything builds
-p moq-relayat moq main (f2f9bc935e) on the bench's pinned nightly (1a2c4797e, 2026-10-21), as moq configures it: dev profile,debug = "line-tables-only", incremental on unless a row says otherwise. Each build has its ownCARGO_HOMEand target directory under/var/tmp, so~/.cargo/config.tomldoesn't apply.perf stat -e instructions:uover the wholecargorun. The 32-core host was at load 30 to 45, so I don't report wall time from it. hyperfine reported no instruction counts on these long runs, soperf statreplaced it.-Z self-profilewith LLVM events on a clean build and two moq-net edits, bucketed by query label. Read the shares, not the absolute times.LLVM_passes,codegen_crate, andfinish_ongoing_codegenare left out, since their self-time is the coordinator waiting on workers.--emit=llvm-ir -C codegen-units=256.--emit=llvm-irmakes rustc use one CGU per crate.defineis attributed from its v0 symbol to the crate that defines the item. v0 appends the instantiating crate to generic instances and to O0 copies of#[inline]items, and generic arguments in the path tell those two apart.edit-hub,edit-sync, andedit-async.-Z dump-mono-statsdump, for MIR by defining crate.f36c848).Where rustc's time goes
Shares of rustc self-time, without coordinator waits:
cargo checkcosts 57% of a clean build's instructions (440 G of 767 G), which cross-checks the split.LLVM_module_codegen_emit_objis 73 s of LLVM's 92 s on the clean build, and the optimization pipeline is under 1 s.Levers inside rustc
Retired instructions, in billions (change against LLVM):
-C debuginfo=0rindon LLVM, because itsglobal_asm!sym operands don't build with the Cranelift that ships with this nightly.-Zllvm-tpdeis still an open PR (rust-lang/rust#164108), with -17% instructions on ripgrep reported so far.What the IR is made of
Instructions in unoptimized IR, by the crate that defines each function (9.35 M instructions, 1.65 GB):
#[inline]copies from other crates.github/btree-build-audit.json).#[inline]items are not copied into every CGU at O0, and share-generics reuses upstream instances.What a subset compiler could win
The subset: moq's own build rules.
async fnbodies beyond thin wrappers overpoll_*functions.The candidates are moq's 13 workspace crates and the binary. Every other crate in the build is third-party and stays on rustc.
Linking.
Iterator::mapover a closure defined in a crate that rustc never sees.Clean build.
jobs-frontendvariant moved a clean build by +1.7%.moq-net edit.
65% of its critical path is crates rebuilt only because moq-net changed. A per-item incremental compiler could in principle get the edit down to about the link, roughly 10x.
ra-jit already gets there without a new frontend. It uses rust-analyzer plus Cranelift and splices the changed functions into the linked program.
edit-hubedit-syncedit-asyncedit-hub.edit-asyncfallback at main is ra-jit failing to compile an instance ofusage-argv's genericparsed_values_given. It is not inherent to async: under moq's poll-first rule, the logic an edit touches lives in syncpoll_*functions, which ra-jit serves.What remains for edits that change an API is relinking without rebuilding (quest/m3/relink.md) and upstream's incremental work, neither of which needs a new frontend.
Verdict: no subset compiler
This PR deletes the quest and records the verdict in m4's plan, so the idea isn't revived without new evidence.
Impact
quest/m4/subset-compiler.md, adds the closing note toquest/m4/README.md, and drops the subset compiler from the root's m4 summary.Alternatives
Choices made without asking
f36c848), since the question is about moq after poll-first. The CI rows are labelled as the older pin.perf statinstead of hyperfine, which returned no counts on these runs.Follow-ups
-Zllvm-tpdereaches a nightly the bench can pin (rust-lang/rust#164108). Recommend planning it, as a waiting quest: it targets the 21% of a clean build and 28% of a cache-backed edit measured here.async fnbody.edit-asyncfallback upstream. Recommend dropping it: ra-jit lives outside the kixelated and moq-dev orgs, and the bench README already tracks its moq bugs.Models
Size: XL
Implementer: Claude Code, claude-opus-5-5, unknown effort (the killed starting session)
Implementer: Claude Code, claude-opus-5-5, high effort
(Written by Claude Opus 5.5 with high effort)
Review
Rewritten by
quest reviewafter each round.01a1b3ee-eecd-7672-b5d7-4daef54ba76f, round 2The quest closure remains consistent, the revised performance claims match the report, and just check, quest validation, and git diff --check pass with no defects found.