Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions quest/m4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ build's retired instructions by 16%.

## Required

- [Bump the build benchmark's moq pin past poll-first](/quest/m4/bench-moq-pin.md) - the benchmark builds moq after poll-first, so its hub edit rebuilds the 10 crates main does
- [Bench TPDE on moq](/quest/m4/tpde.md) - what TPDE cuts from moq's clean build and non-incremental edit; waits on `-Zllvm-tpde` reaching a nightly
- [Waiting: a rustc and cargo fork](/quest/m4/fork.md) - the evidence ledger for carrying a fork; condition: enough measured reasons to pay for one
- [moq in pure Go](/quest/m4/go/README.md) - rust2-go translating moq-net, with no cgo, fast enough to replace the cgo bindings for Go users
27 changes: 27 additions & 0 deletions quest/m4/bench-moq-pin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# [S] Bump the build benchmark's moq pin past poll-first

## Goal

The `moq` corpus in [corpus.toml](/bench/build/corpus.toml) pins a moq main
after poll-first ([moq-dev/moq#7607](https://github.com/moq-dev/moq/pull/7607)),
so the benchmark measures the moq its developers edit: the hub edit rebuilds the
10 crates it rebuilds at main, not the pin's 8, and the async body edit is a
thin wrapper over a `poll_*` function, as moq's rule makes it.

## Plan

Decided with the maintainer on 2026-11-07: m4. Found by the subset-compiler
report ([moq-dev/rust2#615](https://github.com/moq-dev/rust2/pull/615)), which
measured at moq main because the pin (`f36c848`) predates poll-first.

- Land the bump on its own, as corpus.toml asks, so no report compares numbers
across it.
- Update what names the old tree: the `sync` and `async` lines (at main,
`Session::closed` awaits `poll_closed`), the `test` package versions, and the
bench README's moq notes, such as the ra-jit bugs seen at the pin. At main,
the report saw `edit-async` fall back on usage-argv's `parsed_values_given`.
- `moq-pure-crypto` is the old rev plus moq's `spike/pure-crypto` branch, so the
bump leaves it comparing a different tree. Recommended: merge moq main into a
new spike branch in moq-dev/moq and pin that, so the comparison still holds.
- Out of scope: [nix.toml](/bench/build/nix.toml)'s own moq pin, which the Nix
comparison keeps for crane's dependency layer.
40 changes: 40 additions & 0 deletions quest/m4/tpde.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# [M] Bench TPDE on moq

## Goal

The [build-speed benchmark](/bench/build/README.md) gains a `tpde` variant, on
the nightly that ships `-Zllvm-tpde`, against `nightly` in the same job. Its
report says how much TPDE, a fast O0 machine-code generator for LLVM IR, cuts
moq's clean build and non-incremental hub edit, and how many codegen units fall
back to LLVM.

## Plan

Decided with the maintainer on 2026-11-07: m4.

What it targets, from the subset-compiler report
([moq-dev/rust2#615](https://github.com/moq-dev/rust2/pull/615)) at moq main:
LLVM is 21% of a clean build's rustc self-time and 28% of a non-incremental
moq-net edit's (36% with building the IR, which TPDE does not replace), almost
all of it O0 machine-code emission. The incremental edit spends 0.1% in LLVM,
so expect nothing there. Cranelift, the existing lever on the same step, cut
instructions by 16% clean and 25% on the non-incremental edit.

- Bump the nightly in `flake.nix` to one that ships the flag, then add the
variant beside `cranelift` in [corpus.toml](/bench/build/corpus.toml), with
the same scenarios. `nightly` moves with the bump, so the variant's change
compares within one run.
- Recommended: `-Zllvm-tpde=try`, which falls back to LLVM per module where
TPDE fails (inline and global assembly, SIMD, sanitizers); `=only` fails the
build instead. Report the fallback count.
- Recommended: list it in the nightly moq job in
[bench.yml](/.github/workflows/bench.yml) beside `cranelift`, since upstream
plans to optimize the TPDE path after it lands.

## Waiting

- rust-lang/rust: [rust-lang/rust#164108](https://github.com/rust-lang/rust/pull/164108)
adds `-Zllvm-tpde`. Check that it merged and that a nightly from
`rust-bin.nightly` in `flake.nix` accepts the flag: `rustc -Z help` lists
`llvm-tpde`, and a `-Zllvm-tpde=only` build of a hello world succeeds, since
a shipped toolchain may build without TPDE.