We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10dde7e commit ea4543fCopy full SHA for ea4543f
text/0000-benchmarking.md
@@ -107,7 +107,16 @@ fn my_benchmark(bench: Bencher) -> BenchResult {
107
bench.iter(|| {
108
black_box(pow(y, x));
109
pow(x, y)
110
- });
+ })
111
+}
112
+```
113
+
114
+In case you want the benchmark to run for a predetermined number of times, use `iter_n`:
115
116
+```rust
117
+#[bench]
118
+fn my_benchmark(bench: Bencher) -> BenchResult {
119
+ bench.iter_n(1000, || do_some_stuff());
120
}
121
```
122
0 commit comments