You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the bench function on divan::Bencher, I'd like to introduce a BenchmarkContext (naming open to bikeshedding). The motivating use-case is to expose a function called something like inject_simulated_delay which can be used to add simulated overhead to the benchmark without needing to actually do it. An example of this is for example benchmarking a caching algorithm that would normally do expensive I/O on a miss. In practice, it's more convenient in a microbenchmark to simulate performance by just simulating how long I think the I/O would take.
You can hang other state off the context too (e.g. what sample/iteration the current iteration is on in case that matters for some applications).
Not sure if there's any better alternative to make this work since bench functions consume self which is intrinsic to the design.
Happy to actually implement it but was curious about thoughts first.
The text was updated successfully, but these errors were encountered:
For the
bench
function ondivan::Bencher
, I'd like to introduce aBenchmarkContext
(naming open to bikeshedding). The motivating use-case is to expose a function called something likeinject_simulated_delay
which can be used to add simulated overhead to the benchmark without needing to actually do it. An example of this is for example benchmarking a caching algorithm that would normally do expensive I/O on a miss. In practice, it's more convenient in a microbenchmark to simulate performance by just simulating how long I think the I/O would take.You can hang other state off the context too (e.g. what sample/iteration the current iteration is on in case that matters for some applications).
Not sure if there's any better alternative to make this work since
bench
functions consumeself
which is intrinsic to the design.Happy to actually implement it but was curious about thoughts first.
The text was updated successfully, but these errors were encountered: