Zig 0.16 introduced std.Io, a cross-platform I/O and concurrency interface, but the only working implementation (std.Io.Threaded) spawns OS threads, making it unsuitable for high-concurrency workloads. The author presents zio 0.11, a drop-in std.Io implementation using stackful coroutines and native async OS APIs (io_uring/epoll on Linux, kqueue on BSD/macOS, IOCP on Windows). A benchmark shows 10,000 concurrent sleeping tasks completing in ~10 seconds with zio versus ~20 seconds with the threaded implementation, and zio scales to 50,000+ tasks without hitting OS thread limits. The API is nearly identical to std.Io.Threaded — just initialize a zio runtime and pass its io() handle anywhere std.Io is expected, including std.http.Server.
12.2K Impressions1 Comment