Repository navigation
Open
Labels
Description
Goal
Make recompilation cost proportional to what changed. Today every compile re-parses, re-analyzes and re-lowers the whole program, so a one-line edit in a large app (Symfony, Laravel) pays the full front-end cost (minutes, multi-GB IR peak). Target: warm rebuild after a small app edit in seconds, with output byte-identical to a cold build.
Principles
- Correctness over speed: warm output == cold output, enforced by a test. A cache bug that silently serves stale code is worse than no cache.
- Content-addressed: keys are hashes of inputs (sources, compiler version, options,
MemoryAbiversion), never mtimes. - Layered: land the cheapest layer with the best win first; each layer is useful on its own.
- Whole-program passes are the hard part (
Monomorphize,InferTypesreruns,InlineClosures,linkonce_odrcoalescing): specialization driven by one unit's call sites must not leak into another unit's cached artifact.
Layers (candidate order, to be settled in design)
- Parse / AST cache per file, keyed by content hash. Lowest risk; the tolerant parser and ranges (Parser: tolerant mode, source ranges and written names (LSP foundation, phase 1) #481) already give a stable per-file unit.
- Signature / symbol index per file or package (
.sig-style export, analyzer per-file index Analyzer: library API, incremental per-file index, ranged diagnostics #453), so unchanged units are not re-inferred, only re-linked against. - Per-unit MIR / LLVM IR /
.oreuse with a dependency graph and invalidation on signature change. Prior art: the stdlib is already a prebuilt.o+.sig, and auto-split compiles IR in parts. - Dependency units: Composer packages cached by content hash (Cache compilation of Composer packages by content hash #497) — the first concrete customer, since vendor rarely changes.
- Watch / daemon mode (long-lived process keeping the index warm), shared with the LSP (manticore lsp: language server over stdio #454).
Work items
- Cache compilation of Composer packages by content hash #497 Cache compilation of Composer packages by content hash
- Design doc
docs/design/incremental.md: cache unit, key, dependency graph, invalidation, storage layout, GC - Cache infrastructure: directory layout, concurrency-safe writes,
--no-cache, cache-clean command, hit/miss log - Per-file parse/AST cache
- Signature export/import for unchanged units
- Cold-vs-warm byte-identity test; cache disabled (or proven identical) for the self-host fixpoint
- Benchmarks: cold vs warm on
examples/symfony-console, Symfony app, Laravel
Out of scope
- Cross-machine / remote cache (revisit once local cache is stable).
- Speeding up a cold build (tracked separately: front-end inference cost, IR size).
Acceptance
Warm rebuild after touching one app file does not re-process vendor or untouched app files (verifiable via hit/miss log), is measurably faster with numbers recorded in the design doc, and is byte-identical to a cold build.
Activity
blacktrs commentedon Oct 26, 2026
Related spike: #500 (hot reload, time-boxed research).