river's util module (the Wayland compositor's global allocator + monotonic clock helpers) built two ways, to prove azazel and zaza on a real systems project.
river's full build needs Wayland and pkg-config system libraries, which don't
reproduce on every host — but this self-contained std-only utility builds
anywhere. Both build a consumer that calls msecTimestamp, and link libc for
river's c_allocator.
| Repository | https://github.com/riverwm/river |
| Commit | f8f0e4ab88ad9671e9e164ef87cae3b839da33da |
| File | river/util.zig |
| Zig | 0.16.0 |
cd azazel && ./fetch.sh && sh gen_build_spec.sh && zig build && ./zig-out/bin/consumer
cd zaza && ./fetch.sh && zig build runBoth print river util: msecTimestamp = <n>.
| Build | What it does | Config |
|---|---|---|
| azazel | imports the util module + a consumer, links libc, as CUE data | project.cue, 15 lines |
| zaza | imports the util module + links libc via the Zig build graph | build.zig, 14 lines |
Both build roots stage the pinned upstream with fetch.sh into a git-ignored
vendor/ (a curl for single-file slices, a shallow clone for source trees) —
no upstream sources are committed. Then:
- azazel:
sh gen_build_spec.shruns CUE and emitsbuild_spec.zig(the build declared as data), thenzig buildcompiles it. The CUE step is memoized — it re-runs only when the model changes (~0.20s → ~0.01s otherwise). - zaza:
zig builddrives the standard Zig build graph directly.
Measured across the corpus (clean vs warm builds):
| Lever | Speedup | Note |
|---|---|---|
| Content-addressed cache (rebuild) | 89× | 14.2s → 0.16s; Zig has it, both inherit it |
| Incremental (edit one file) | 10.8× | 14.2s → 1.32s; deps stay cached |
| CI dependency cache | 2× | cold 13.3s → warm 6.6s; this repo's CI caches ~/.cache/zig |
| Memoized CUE codegen | 20× | azazel's only overhead, gone |
| Parallelism (many cores) | 1.1× | marginal — shared std + startup dominate |
| GPU | none | compilation is branchy, sequential, dependency-ordered |
The instinct to parallelize like a C++ build doesn't transfer: Zig is one
mostly-single-threaded compile per artifact with a fast self-hosted backend and a
shared std that caches. For Zig, caching is the lever, not parallelism.
The real frontier is residency: a resident compile server that keeps the InternPool hot and recompiles only changed declarations, plus in-place binary patching (Zig's roadmap) and a shared content-addressed cache. azazel's build-as-data is positioned for it — the build is a query, and the cache key is computable from the pinned model without running the compiler. Full write-up and the cross-repo comparison: the corpus dashboard.