HEADSTART implements an optimization for Rust compilation that emits crate metadata early so dependent crates can begin type-checking before their dependencies finish checking function bodies. It adds a rustc front-end split (a new analysis_interfaces query) that writes an .early-rmeta file after interfaces are checked and before bodies, and it updates crate loading to accept early metadata and later swap in full metadata before code generation. Cargo is patched to pass -Zearly-metadata, start dependents when early metadata appears (for both check and build), yield paused job slots to other work while waiting for full metadata, and only report a crate's output after all dependencies succeed. The changes are packaged as commit-series patches aimed at upstream PRs and expose flags/environment variables to opt in.
Benchmarks on 16-core machines show substantial speedups: up to 54% faster for cargo check and up to 42% for cargo build on a set of 13 real projects (rust-analyzer, bevy, polars, etc.), with the parallel front end adding up to 25% extra improvement; none of the tested projects became slower. Gains shrink on smaller machines (e.g., rust-analyzer on 4 cores: ~24% check, 13-15% build). Costs include increased peak memory, some downstream work that may be thrown away if a dependency fails, and slightly different timing/order of diagnostics, but exit status and diagnostic content remain unchanged. Comprehensive scripts cover setup, verification, incremental tests, and benchmark suites.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.