This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 11/4/2026.

Benchmarking

import std/benchmarking

std/benchmarking — in-process timed benchmark harness. Drives a body through

benchmarking.kz · 4 tors

std/benchmarking — in-process timed benchmark harness. Drives a body through the effect-branch engine for a wall-clock duration, then reports the iteration count and the measured nanoseconds. Like hyperfine's timed runs, but in-process and zero-overhead: the `! pass` effect fires once per iteration until `seconds` elapse; `| done` carries the pass count and elapsed time. The drag-race protocol is `run(seconds: 5)` with the sieve in the `! pass` body, then emit the result.

~part climb koru_std/benchmarking.climb.kz

Koru Standard Library: the `climb` part of benchmarking.kz. Joined via `~part climb` in benchmarking.kz; merged into the module at load. CLIMB — the hill-climb protocol (nanoui's hillclimb/): `warmup` unmeasured passes, then `frames` measured passes, the whole thing `reps` times. Each rep reduces its per-pass durations to a median; the result is the LOWEST median across reps. Never a mean: on a shared machine noise only ever adds time, so the lowest median is the capacity estimate noise cannot fake. Inside a pass, `lap(k)` marks a phase boundary. Laps 1..n fire once each, in order, every pass — the first measured pass fixes n, and any pass that skips, repeats, or reorders a lap panics (a mis-placed mark is a broken instrument, not a smaller number). `lap.ms(k)` reads phase k's lowest median after `| done`: phase k runs from mark k-1 (mark 0 = pass start) to mark k, and phase n+1 is the tail from the last lap to the pass end. Each phase takes its own lowest median, so phases need not sum to `ms` exactly.