Zig Splits Build System Into Configurer and Maker, Cutting `zig build -h` by 90%
Andrew Kelley landed a major rework of Zig’s build system that separates the build pipeline into two distinct processes. The new ‘configurer’ compiles only the user’s build.zig in debug mode to construct a build graph, which is then serialized to a binary configuration file and cached. A separate ‘maker’ process, compiled once per Zig version in release mode and reused via the global cache, consumes that file to execute the graph. Previously, build.zig logic and the entire build system implementation were bundled into a single debug-mode process that ran on every invocation.
The performance impact is substantial: benchmarks of zig build -h show wall time dropping from 150ms to 14.3ms, with CPU cycles down roughly 96% and peak RSS reduced by 7.4%. The split also lets Zig skip rerunning build.zig entirely when inputs haven’t changed (for example, when only adding -freference-trace), and positions the build system to keep adding features like --watch, --fuzz, and --webui without slowing down everyday builds. Third-party tooling such as ZLS is expected to benefit by consuming the serialized configuration rather than forking the build runner.
The change is largely non-breaking, but build scripts can no longer observe passthrough arguments via b.args; the new run_cmd.addPassthruArgs() replaces the common pattern, trading that visibility for avoiding rebuilds when arguments change. The work ships in the upcoming 0.17.0 release. The same devlog also covers incremental compilation support landing for the LLVM backend in 0.16.0 and a 30,000-line type resolution redesign that makes the compiler lazier about analyzing fields of types used purely as namespaces.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.