Against Query Based Compilers
2 days ago
- #incremental-computation
- #compilers
- #programming-languages
- Query-based compilers apply incremental computation to compiling, allowing selective recomputation when inputs change.
- Early cutoff optimization stops change propagation if a function's result remains unchanged despite input changes.
- Incremental compilation is crucial for IDEs, requiring updates proportional to the change size, not the codebase size.
- The principal limitation is that update work can't be smaller than the change in the result, exemplified by encryption functions with avalanche properties.
- Zig's design allows independent file parsing and name resolution, reducing the need for queries, unlike Rust which requires crate-wide operations due to macros.
- Language semantics can be leveraged to manually partition compilation tasks into coarse-grained, independent chunks.
- In-place updates and diff-based approaches offer more direct methods for maintaining global structures like declaration maps.
- Zig plans to use in-place patching for incremental linking, updating binaries without full recomputation.