4 posts with tag zig

Scalar Replacement of Aggregates: How "Copy to Locals" Unlocks the Compiler

How copying a small aggregate into local variables exposes Scalar Replacement of Aggregates to LLVM, letting hot loops keep state in registers instead of repeatedly loading and storing through a pointer—illustrated with Zig/Rust reproductions and TigerBeetle's AEGIS-128L speedup.

· 12 minutes reading time

Building a custom Bitset - A study in access-pattern-driven data structure choice

Shows that data-structure choice must be driven by access pattern, not category: a custom bitset with SBO and virtual-mutation hashing is strongly justified for a hot-path DFS that repeatedly clones, hashes, and probes without committing, while the standard-library DynamicBitSet is the right tool for a simple one-shot debug assertion

· 21 minutes reading time

Zig Allocation Patterns

A practical reference on Zig allocation patterns - breaking down the aware (unmanaged) vs. owning (managed) ownership models, arenas, index arenas, and other key idioms used in porcupine-zig, with real code examples and tradeoffs

· 14 minutes reading time

Why Zig’s Io Feels Like an Effect System (Without Being One)

Explains how Zig’s Io gives you most of the engineering wins of effect systems (no function colouring, swappable interpreters) without any type-level tracking — here’s how it stacks up against Scala 3 Caprese and Kyo across the full design spectrum of effects

· 16 minutes reading time