Closed cBournhonesque closed 6 months ago
You are correct that the first and second example do not include string generation time in benchmark timings. However, that's where the similarities end.
Differences:
black_box
every string, preventing the compiler's optimizer from making assumptions about the data. In the second example, Divan does not black_box
the closure passed to bench
/bench_local
and thus the optimizer may allow the code to appear more optimal than it would in practice in real world scenarios.
Hi,
I'm not sure I understand the use of
with_inputs
.Let's say I have this benchmark:
I get that the time to create the strings wouldn't affect the benchmark.
But what about if I create the string inside
bench_local
, like this?The time to create the string is also not included in the benchmark right? Therefore is the use of
with_inputs
mostly to have additional helpers such asinput_counter
?