diff --git a/text/0000-benchmarking.md b/text/0000-benchmarking.md index 0b008467004..7a5d426a641 100644 --- a/text/0000-benchmarking.md +++ b/text/0000-benchmarking.md @@ -107,7 +107,16 @@ fn my_benchmark(bench: Bencher) -> BenchResult { bench.iter(|| { black_box(pow(y, x)); pow(x, y) - }); + }) +} +``` + +In case you want the benchmark to run for a predetermined number of times, use `iter_n`: + +```rust +#[bench] +fn my_benchmark(bench: Bencher) -> BenchResult { + bench.iter_n(1000, || do_some_stuff()); } ```