While implementing the Levenshtein edit distance algorithm in Oak, I came up with a handy quick benchmark helper function:

fn bench(name, f) {
	start := time()
	f()
	elapsed := time() - start
	'[bench] {{0}}: {{1}}ms' |> fmt.printf(
		name
		math.round(elapsed * 1000, 3) |> string()
	)
}

Use it as with bench('...') fn { ... }, like

[3, 4, 5, 6, 7] |>
	std.map(fn(n) int(pow(10, n))) |>
	with std.each() fn(max) {
		with bench(string(max)) fn {
			std.range(max)
		}
	}

for output like

[bench] 1000: 1.737ms
[bench] 10000: 13.052ms
[bench] 100000: 131.559ms
[bench] 1000000: 1316.693ms
[bench] 10000000: 12747.569ms