SQLite built two ways, to prove and compare azazel and zaza against a real third-party C library. This is the corpus's clean test of building a C library from source rather than consuming a prebuilt one.
- azazel builds a Zig program that compiles SQLite's amalgamation
(
sqlite3.c) as a native C source, links libc, and calls into it through@cImport. The whole C-in-Zig build is declared as data in a CUE model. - zaza compiles
libsqlite3.afrom source as a C static library, then builds and links a downstream C consumer that runs a query.
Neither vendors SQLite's sources. Each side stages the pinned amalgamation with
its own fetch.sh into a git-ignored vendor/.
| Source | SQLite amalgamation |
| Version | 3.46.1 (sqlite-amalgamation-3460100) |
| Files | sqlite3.c (9.1 MB) + sqlite3.h |
| Deps | none |
# azazel: compile sqlite3.c inside a Zig program via the CUE model
cd azazel && ./fetch.sh && sh gen_build_spec.sh && zig build && ./zig-out/bin/sqlite_demo
# -> sqlite 3.46.1
# SELECT 2 + 3 = 5
# zaza: compile libsqlite3.a from source, link + run a C consumer
cd zaza && ./fetch.sh && zig build run
# -> zaza+sqlite slice: built libsqlite3 from source, SELECT sum(n) = 9 (sqlite 3.46.1)Clean-cache builds, Apple Silicon, fastest of two runs. Both sides compile the same 9.1 MB amalgamation, so the compile itself dominates.
| Build | Clean build | Config |
|---|---|---|
native cc -O2 |
7.1 s | a compiler invocation, no build system |
| CMake (configure + build) | 8.7 s | CMakeLists.txt — 7 lines |
| zaza | 11.7 s | build.zig — 67 lines |
| azazel (cold) | 14.1 s | project.cue — 22 lines |
| azazel (warm shared cache) | 0.25 s | restores the artifact, skips the compile |
Two honest readings:
- Cold, on a single C file, plain
ccwins.zig cccarries real overhead compiling the 9 MB amalgamation that clang alone does not, so azazel and zaza are slower thanccon a first build. Against CMake, the build system a C project would actually use, zaza and azazel are within a few seconds and skip the configure step. - Repeat builds invert it. The azazel key is computed from the model before
compiling, so a warm shared-cache build restores the finished artifact in
0.25 s. Every rerun, every CI job, and every other machine skips the 7 s
compile that
ccpays every single time.
The point of this slice is not to beat cc at compiling one file. It is that
both systems build a real C library from source, and that azazel's model-keyed
cache turns the second build and every build after it into a restore.
Both roots stage the amalgamation with fetch.sh (a curl of the official zip)
into a git-ignored vendor/; no upstream source is committed.
- azazel:
sh gen_build_spec.shruns CUE and emitsbuild_spec.zig(the build as data), thenzig buildcompilessqlite3.cinto a Zig executable that links libc and calls the C API. The CUE step is memoized — it re-runs only when the model changes. - zaza:
zig buildcompilessqlite3.cinto a static library with the feature defines as its own compile options, then links a C consumer against it through the Zig build graph.
azazel/cache_build.sh computes a content key from the model — the normalized
CUE, the sources reachable via @import, the pinned inputs, and the toolchain —
without invoking the compiler, then restores zig-out from a free GitHub
Releases store on a hit. CI runs through it: the first build of a commit uploads
the keyed artifact, and every rerun downloads it and skips the compile.