We’ve recently added zig build check
to TigerBeetle, which works similar to cargo check
. That is, it’s an almost normal, except that -fno-emit-bin
is passed to the compiler, so that no time is spend in LLVM. The intended use-case is to check for compilation errors while you are hacking away and not yet ready to actually run the code:
What surprises me a great deal is that check
seems to be much faster, even if there are errors! Naively, I’d expect the time to first error to be more or less equivalent between the two, but it is wildly different:
zig build
— 7.8szig build check
— 1.1s
Both are cached, repeated builds of code with a simple sema error.
If we don’t even get to emitting a binary due to compilation errors, what makes the check
build so much faster?
Also, PSA, you might want investigate adding zig build check
to your workflow.