zig Posts
A collection of my posts on zig. Whether I'm trying to
build something new or figure out how to break it, these notes, fixes,
and deep dives document my process. I hope you find them useful.
-
The Zig 0.16 release brought a complete I/O system redesign. Here is my experience migrating
cmdtest, including the new Child process API, file operations, and what I had to learn along the way. -
Experimenting with low-level optimizations in Zig. I wrote a benchmark to race SIMD vectors against bit-twiddling hacks for skipping JSON whitespace.
-
I'm building a benchmarking tool for Zig and needed CPU counters. This is how I wrapped Linux's
perf_event_opento be type-safe with comptime. -
I spent a while debugging a benchmark that was impossibly fast. Turns out LLVM is too smart. I fixed it by forcing runtime reads with volatile.
-
Measuring execution time under
1nsis hard. This post covers how I fixed accuracy issues in my Zig tool by running the function in batches. -
A classic stack-use-after-return bug I ran into with Zig. I was trying to be clever and pass a reader by reference, but ended up with a dangling pointer.
-
Working on
cmdtest, my Zig CLI testing tool, I ran into the problem of readingstdiofrom long-lived processes. This is my dive into why memory allocation is key for handling program output. -
My journey designing a Zod-like validation library in Zig. A dive into
comptime, type generation, and the trade-offs for good tooling support. -
I'm sharing my experience building
cmdtest, a Zig package for testing CLI apps. This post covers Zig I/O, comptime vs runtime, andbuild.zigimport quirks.