Exclude executor teardown from the measured bench regions

This commit is contained in:
Dennis Kobert
2026-08-27 10:09:19 +00:00
parent eb50be844b
commit 23d9192693
2 changed files with 3 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ fn run_once(c: &mut Criterion) {
let context = RenderConfig::default();
bench_for_each_demo(&mut group, |name, g| {
g.bench_function(name, |b| {
b.iter_batched(
b.iter_batched_ref(
|| setup_network(name),
|(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), std::hint::black_box(context))).unwrap(),
criterion::BatchSize::SmallInput,

View File

@@ -9,14 +9,14 @@ fn update_executor(c: &mut Criterion) {
let mut group = c.benchmark_group("Update Executor");
bench_for_each_demo(&mut group, |name, g| {
g.bench_function(name, |b| {
b.iter_batched(
b.iter_batched_ref(
|| {
let (_, proto_network) = setup_network(name);
let empty = ProtoNetwork::default();
let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap();
(executor, proto_network)
},
|(mut executor, network)| futures::executor::block_on(executor.update(std::hint::black_box(network))),
|(executor, network)| futures::executor::block_on(executor.update(std::hint::black_box(std::mem::take(network)))),
criterion::BatchSize::SmallInput,
)
});