Zero-dependency · Zig 0.16

A benchmarking library for Zig.

zBench measures and compares the performance of code segments — from microbenchmarks to whole-system tests — with percentile timings, allocation tracking, and lifecycle hooks.

Simple API

Initialize, register a function, call run(). The whole surface fits on one screen.

Precise Metrics

Avg, min, max, std-dev, p75/p99/p99.5 percentiles — every measurement, every run.

Allocation Tracking

Optional allocator instrumentation reports bytes allocated and freed per iteration.

Lifecycle Hooks

before_all / after_all / before_each / after_each — set up and tear down without polluting timings.

Shuffling Allocator

Experimental heap-randomizing allocator wrapper to reduce predictable-cache bias.

Pure Zig

No C dependencies. Builds with stock zig build. Tracks Zig 0.16 directly.