Zig: Build System Reworked

356 points · 240 comments on HN · read original →

Zig's build system separated configuration from execution, reducing build times by 90 percent for simple commands.

Andrew Kelley's rework splits the build process into two stages: a "configurer" compiles user build.zig files in debug mode and serializes the build graph, while a "maker" process compiles the build system itself in release mode and executes the graph. The maker is cached globally per Zig version, avoiding redundant compilation. Running `zig build --help` dropped from 150ms to 14.3ms. The change also lets the build system skip rerunning build.zig logic when command-line flags don't affect configuration.

Matthew Lugg separately reported progress on a new ELF linker for x86_64 Linux. It now supports building the Zig compiler with LLVM and LLD libraries and enables fast incremental rebuilds in milliseconds while linking external libraries, without performance overhead. DWARF debug information support remains pending.

What HN community is saying

Commenters are skeptical about "terrific" compilation claims. One user reported `zig test` taking several seconds for trivial code with `-OReleaseSafe`, arguing this contradicts the fast-compile messaging and citing C++ toolchains completing 10k LOC projects in 200ms. Others noted the language is pre-1.0 and breaking changes are expected, though one commenter experienced frustrating API changes between versions. A few defended Zig's ergonomics for systems programming as a middle ground between Python and C, praising its readability and low-level control.