Skip to content
Back to skills

Fannkuch Iterate

ASecurity

One round of the fannkuch-redux Maxon-vs-C loop — build the tree's compiler, measure and profile examples/fannkuch-redux.maxon against the C reference, choose ONE emitted-code optimization, /land it, then a real interleaved A/B against a control compiler built from the pre-change commit, and a log row. Invoke as `/fannkuch-iterate [candidate]`; repeat until the n=12 ratio is at or below 1.0.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 16, 2026
developmentpythongogit

Works with

  • cli

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add maxon-lang/maxon --skill fannkuch-iterate --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fannkuch Iterate?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Fannkuch Iterate
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/maxon-lang-fannkuch-iterate/badge)](https://www.skillsdirectory.com/skills/maxon-lang-fannkuch-iterate)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: fannkuch-iterate
description: One round of the fannkuch-redux Maxon-vs-C loop — build the tree's compiler, measure and profile examples/fannkuch-redux.maxon against the C reference, choose ONE emitted-code optimization, /land it, then a real interleaved A/B against a control compiler built from the pre-change commit, and a log row. Invoke as `/fannkuch-iterate [candidate]`; repeat until the n=12 ratio is at or below 1.0.
---

# One round of the fannkuch loop

**One invocation = one measured, landed, A/B'd compiler change.** The instrument is
`scripts/bench-fannkuch.py`; the ranking is `bench/fannkuch/README.md`; the history is
`docs/fannkuch-benchmark-log.md`. Read the README's traps before the first round.

> ## ⭐ ONE ROUND IS ONE SESSION, ON `main`, LANDED BY `/land`'s OWN TAIL
>
> The loop runs on `main` like any other change: `/land`'s rebase on `origin/main`, its landing gates ONCE,
> one commit, one push — and no waiting for CI after it. Start each round in a fresh session — a round's context is the README ranking, the log and
> this file, not the previous session's transcript.

## 1. Orient

- `git branch --show-current` is `main`; `git status` is clean; `git fetch` shows nothing behind
  `origin/main`.
- Build the compiler from the tree: `./maxon-bin/.maxon/maxon.exe run build` at the repository root
  (`scripts/build-from-seed.sh` if the slot is empty). One self-compile is enough for the PROGRAMS it
  emits. The compiler's OWN code is emitted by the compiler that built it, so §5's `--self-compile`
  arm needs a second build with the first build's output — without it the experiment's self-compile
  shows only the new pass's cost, never its codegen win.
- Nothing else may be building or running the suite on the box while a measurement runs.

## 2. Measure

```
python scripts/bench-fannkuch.py --n 11 --runs 5 --profile
```

Read, in this order: the ratio; the census columns; the profile's hot functions; then the IR of the
hot functions in `bench/fannkuch/out/slot/fannkuch-redux.ir`. Rebuild with `--emit-ir-function=<name>`
when a library body (`__managed_*`) is where the time went. Under ~2 s at n=11, profile with
`--profile-n 12` so the sampler has enough samples.

## 3. Pick ONE candidate

From the README ranking or from what the profile shows. Before touching code, write down:

- the SHAPE it targets in this program: which loop, which instruction sequence, how many times per
  permutation;
- the predicted census movement (which column, by roughly how much);
- the soundness argument, in one paragraph.

A candidate that names no shape is not a candidate.

## 4. Land it

`/land <the change>`, with these substitutions for an optimization:

- The red set is the rule FIRING: a case whose pinned output shows the new shape, red before the
  change as `/land` requires. Beside it go the SOUNDNESS controls — one case per boundary the
  soundness argument names, whose answer a wrong rule would change. They are cases, and nothing else:
  ⛔ **no sabotage** — no breaking the rule or the compiler to watch a control fail (`/land`'s NO
  MANUAL TESTS). A boundary worth guarding is a case; one that is not is not run. A `TargetIr`
  pin in `ir-specs/` is a gate: an emitted-code change that moves one re-mints it with
  `--update-required --filter=<spec>/`.
- Every target the change touches gets the equivalent change (x64, arm64, wasm) or a stated reason.
- ⛔ **During the round, never run the entire spec suite** (user ruling). Every spec run — yours, an
  implementer's, a reviewer's — is ONE `spec-test` over the spec files the change touches, one
  `--filter=<spec>/` per file, on x64, and again with `--target=wasm32-wasi` only when the change
  touches wasm lowering. The full suite is CI's, after the push (`/land` §8); `maxon lint maxon-bin` is the
  E3092 gate and is not a spec run.
- ⛔ **A filtered-green compiler is not a working compiler.** Once the filter is green, before the A/B,
  the implementer runs `maxon test tests/examples --filter=fannkuch`, which builds the example this
  round measures and checks its n=10 answer (73196 / 38). A red case there is a red gate,
  and the function it died in becomes a spec case.
- Run §5 and §6 below between `/land`'s landing gates and its commit, so the round is ONE commit carrying
  the compiler change, its spec, the README row, the log rows and the roadmap row. A push rejected
  by a newer `origin/main` is `/land`'s: rebase and re-run §8.

## 5. A/B

`PRE` is the commit the change sits on, taken AFTER `/land`'s rebase — the change is still uncommitted,
so that is `PRE=$(git rev-parse --short HEAD)`. A `PRE` taken before the rebase is a control missing
every commit the rebase brought in.

The harness builds the control once, in its own git worktree under `bench/fannkuch/out/ref-$PRE/tree/`,
with that tree's own `scripts/fetch-seed.sh` and `scripts/build-from-seed.sh` — seed → `C1` → `C2`, so
the control is at its own fixed point — then deletes the worktree, keeps the binary and its `stdlib/`,
`runtime/` and `scriptlib/` in `bench/fannkuch/out/ref-$PRE/`, and reuses them by sha.

```
python scripts/bench-fannkuch.py --n 11 --runs 5 --ref $PRE --self-compile --note "<candidate>: <mechanism>; census <col> a->b; predicted <shape>; both arms at their own fixed point"
```

Control and experiment are two compilers in ONE session, runs interleaved, the control first whatever
the argument order. A before/after across a source change is not an A/B (roadmap, EC19). The note
carries the WHY; the tool cannot.

> ## ⛔ HALT ON A SLOWER SELF-COMPILE (user ruling)
>
> `--self-compile` times each arm's compiler compiling `maxon-bin`. **A `HALT` line means the change made the compiler compile
> itself more than 5% slower than the control does.** Do not land it; do not narrow the pass to make
> the number pass. Stop, report the two times and the mechanism, and wait for the user's ruling —
> the compiler's own build time is a budget the user owns, and a benchmark win does not spend it.
> Between +2% and +5%, say so in the note and carry on.

> ## ⛔ THE BENEFIT GATE — a round lands only if it measured a real win
>
> The change lands when EITHER holds:
>
> - **fannkuch**: the experiment's n=11 median beats the control's by at least 2% AND by more than
>   the wider of the two arms' min-to-max spread; or
> - **the compiler itself**: `--self-compile` shows the experiment at least 2% faster than the
>   control (the compiler is a large real program, and a general pass that helps it has proven
>   itself even where this loop's inner loops did not move).
>
> Below both bars, READ the census and the profile from the same run before deciding, because the
> three ways to miss have three different answers:
>
> | What the run shows | Meaning | Do |
> |---|---|---|
> | the census column predicted in §3 did not move; the IR still holds the shape | the pass missed its shape — an implementation miss, not a wrong idea | ONE bounded fix, then ONE more A/B; a second miss declines |
> | the census moved as predicted, the medians did not | the premise "this shape costs time" was wrong (EC14) | decline — no improvement to the pass can repair a wrong premise |
> | the census and the time moved, but under the bar | the shape is not hot enough; the ranking was wrong | decline; re-rank from the profile |
>
> **Declining** means: the compiler change and its spec do NOT land. Revert them, and commit only the
> record — the README row marked DECLINED with the two medians, the census movement and the mechanism,
> the log rows §5's `--note` already wrote, and the roadmap's DECLINED row — so the next session does
> not rebuild it. A decline is a measurement, not a failure; the roadmap's
> DECLINED rows are its most-cited ones.

## 6. Headline

Whenever n=11 moved by more than the arms' spread. One run is enough while the arms are far apart;
take 5 only when they are within a few percent of each other or of C:

```
python scripts/bench-fannkuch.py --n 12 --runs 1 --warmup 0 --ref $PRE --note "<candidate> headline"
```

## 7. Record

- `bench/fannkuch/README.md`: mark the candidate closed with its measured delta (or DECLINED under
  §5's gate, with the measurement and which of the three misses it was), and re-rank the rest from
  the NEW profile.
- `docs/emitted-code-roadmap.md`: a row in the workstream's format when the change is a codegen change.
- README + log + roadmap go into the round's one commit (§4), which `/land` pushes.

## 8. Stop condition

Maxon median ≤ C median at n=12 over 5 runs, both arms verified, C built by the README's command.
The final row's note begins `HEADLINE`.

## Anti-patterns, each already paid for once

- **Instruction count is not time.** `EC14` deleted two loads from the anchor loop and measured zero.
- **Attribute the shape before predicting the win.** The eight-row EC workstream was ×1.90 on fannkuch
  and −5.8% on nbody.
- **Rows rot.** Re-measure before planning from a row.
- **Fixed-order runs manufacture a sign.** The harness interleaves; do not time by hand.
- **A green suite cannot see a premature free.** `A3`'s maximal elision passed 6,954 cases and printed
  a silent wrong answer.
- **Never touch the instrument to make a number look better.** Write no row you did not measure.
- **A change to emitted runtime (`Compiler/Runtime/`, `Targets/*/*Runtime*.maxon`) shows in the
  programs the compiler builds after ONE build**, and in the compiler's own behaviour only after two.
- **`ir-specs/` pins move with emitted code.** A round that changes what the compiler emits re-mints
  the pins it moves, under `--update-required` with a filter, on each lane this host runs, and reads
  only the pins of the specs the round touches.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.