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/benchmarkingstd/benchmarking — in-process timed benchmark harness. Drives a body through
benchmarking.kz · 4 tors
~pub tor run { seconds: i64 }
! pass
| done { passes: i64, seconds: f64 }~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.
// 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.
~pub tor climb { warmup: i64, frames: i64, reps: i64 }
! pass
| done { ms: f64, laps: i64, frames: i64, reps: i64 }~pub tor lap { k: i64 }~pub tor lap.ms { k: i64 } -> f64