Issue #1234: Profile the compiler, speed it up and parallelise its Nikaia

Open and answer this issue on GitHub.

compiler, ready, future · opened 2026-11-04 · updated 2026-11-04 · 0 comments

What this is

Profile our own compiler, make it faster where the measurement points, and let the parts written in Nikaia use more than one core.

This is not needed for the current focus. It is filed now so the plan is not lost, and labelled future.

Where we stand

Almost all parallel work in the toolchain today is in the Rust driver:

The compiler’s own Nikaia (crates/nikaia-std/src/tools/*.nika) runs on one core. Nobody has yet measured how a build splits between our code and rustc, so it is open whether parallelising our part would be noticeable at all.

Candidates, roughly by expected gain

  1. The prover’s obligations. Each obligation is independent of the others; they are a natural fit for the pool.
  2. The check per function. Each function can be checked on its own, but today one mutable context (errors, caches, counters) is threaded through all of them. That context, not a missing par_iter, keeps it sequential. It needs a redesign: each function produces its own result (errors, facts, cache entries), and the results are merged afterwards in a fixed order, so the error output stays deterministic.
  3. The emit per function. Writing the Rust for one function depends only on that function’s checked form.
  4. Independent files of a project, parsed and checked side by side up to the point where they need each other’s signatures.

To build

  1. Measure first, as docs/measuring.md says (counted instructions, never time): one build of examples/ and one lower-std, split per phase (parse, check, prove, emit, rustc). The result goes into a note under docs/.
  2. From the measurement, pick the phases worth the work. If rustc dominates, the gain lies in emitting less or simpler Rust, not in parallel checking.
  3. Single-core improvements the profile points at (hot loops, needless copies, allocations), each with its before and after.
  4. The prover’s obligations on the pool, with the result order fixed.
  5. The checker’s context split into per-function results plus a merge step; then the check per function on the pool.
  6. The emit per function on the pool.

Each step is measured before and after; a step that does not pay is reverted, not kept.

What must not change


Generated by Claude Code

Back to Open Issues