Repository navigation
Open
Labels
Description
Problem
Every compile re-parses, re-analyzes and re-lowers the whole program, including Composer dependencies under vendor/. Vendor code is effectively immutable between compiles (it changes only on composer install/update), yet it dominates front-end time and IR size for real-world apps (Symfony, Laravel: minutes of compile time, multi-GB IR peak). Users pay that cost on every edit of their own code.
Goal
Cache the compilation results of Composer packages, keyed by a content hash, so an unchanged package is not analyzed again on the next compile. Editing application code must not invalidate vendor work.
Proposed approach (to be validated in design)
- Cache key per package: hash of package files (or
composer.lockentry: name + version +dist.reference, with a file-hash fallback for path/VCS repos) + compiler version + options that affect output (target, opt level, type-check mode,MemoryAbiversion). - Cache unit: package-level (or autoload-unit) artifact, e.g. parsed AST / inferred signatures / MIR / object code. The right layer is the main design question; cheaper layers first (parse + signatures), object-level reuse later.
- Invalidation: a package's key changes → rebuild that package and everything that depends on its signatures. The dependency graph must be tracked, since app code and other packages reference vendor symbols and vendor code may call app-defined classes (interfaces, callbacks).
- Storage: a cache directory next to the project (e.g.
.manticore/cache/), safe for concurrent compiles, with a cap/GC policy.--no-cacheand acleancommand for debugging. - Correctness first: a cached build must be byte-identical to a cold build. Cross-package whole-program passes (
Monomorphize,InferTypesreruns,linkonce_odrcoalescing) are the risk: specialization driven by app call sites cannot live inside a vendor artifact.
Open questions
- Which pipeline stage gives the best win/complexity ratio (parse/AST,
.sig-style signature export, MIR, LLVM IR,.o)? Prior art: stdlib already ships aslib/manticore_stdlib.o+.sig. - How do monomorphized/generic instantiations and inlined closures that cross the vendor/app boundary get keyed?
- How are vendor packages with dynamic features (
class_exists, reflection, autoload maps) handled? - Interaction with manifest builds and the module system (
docs/modules.md).
Acceptance criteria
- Second compile of an unchanged Symfony/Laravel app with a warm cache is measurably faster; report cold vs warm numbers.
- Touching only app code does not re-process vendor packages (verifiable via a cache hit/miss log).
- Changing a package version/files invalidates exactly that package and its dependents.
- Cold and warm outputs are byte-identical; a test asserts it.
- Self-host fixpoint is unaffected (cache off for the compiler's own build, or proven identical).
Activity
blacktrs commentedon Oct 26, 2026
Part of epic #498 (incremental compilation).