📈 GH Trending Explorer 🎲 Surprise me

← all repos

PowderworksCode / headstart

git clone https://github.com/PowderworksCode/headstart.git

Start dependent crates before their dependencies finish type-checking

—
stars, 24h
—
stars, 7 days
+157
stars, 30 days · #1,548
157
★ total
4
forks · 1 open issues

Star history starts 2026-10-20; the chart appears after the second daily snapshot.

LanguageRust
License—
Created2026-09-27 (23d ago)
Last pushtoday
Watchers0
OwnerOrganization

Links

README excerpt
# headstart
Start dependent crates before their dependencies finish type-checking.
Every crate waits for the crates it depends on to be fully checked,
function bodies included, before it starts. It doesn't need those bodies
to type-check itself. It compiles against the dependency's interface, the
metadata in its `.rmeta` file.
Headstart makes rustc write an early metadata file as soon as the
interface is checked, and makes cargo start dependents on it. Each
crate's bodies are then checked while the crates downstream are already
compiling.
- **`cargo check`:** dependents run to completion on early metadata.
- **`cargo build`:** dependents do all their analysis on early metadata,
 then wait for the dependency's full metadata before generating code.
 While they wait, they give their job slot back.
If a body has an error, the build still fails with that error, with the
same diagnostics and exit status as today; only progress lines and the
cross-crate order of JSON messages can differ. Cargo reports a crate's
output only once all its dependencies have finished cleanly, and drops
it if one fails. The costs are work downstream that gets thrown away,
errors reported slightly later, and more memory in use at once (see
docs/design.md).
## Pieces
- **rustc, `-Zearly-metadata`** (6 patches):
 - a new `analysis_interfaces` query splits analysis into item
 interfaces and function bodies;
 - the driver writes `.early-rmeta` between the two;
 - crate loading accepts early metadata, and swaps in full metadata
 before code generation, waiting for it if necessary on a lock its
 producer holds until it's written.
- **cargo, `-Zheadstart`** (3 patches):
 - passes `-Zearly-metadata` to every compile;
 - starts dependents on the early-metadata notification, in both
 `check` and `build`;
 - gives a paused compilation's job slot to other work;
 - reports a crate's output only when its dependencies succeeded.
The patches are a commit series, each with a commit message and tests,
meant to become upstream pull requests: see
patches/README.md.
On rustc's default front end, headstart makes clean builds of 13 real
projects (rust-analyzer, zed, bevy, lemmy, polars and others) up to 54%
faster for `cargo check`, and up to 42% for `cargo build`. None is
slower. With the parallel front end (`-Zthreads=8`), which covers some
of the same ground, it adds up to 25%. Those are 16-core numbers. The
gain comes from cores the build would leave idle, so it shrinks on
smaller machines. On 4 cores, rust-analyzer's check is 24% faster and
its build 13–15%, codex-rs's check 14%, and wide builds come out even.
A clean `cargo build` of codex-rs on
16 cores, recorded with
cratebank. Without
headstart, the workspace's own crates compile one after another while
the machine sits mostly idle; with it, each starts on the early metadata
of the one before, and the build is 37% faster.
The same two builds, with time across and dependency depth down: each
unit is drawn under the dependency that released i