mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
Add manually-runnable benchmarks for runtime profiling (#2005)
* Split benches into two files * Implement executor update bench * Restructure benchmarks * Unify usages of wrap network in scope * Remove unused imports * Fix oom bug * Remove bounding box impl
This commit is contained in:
28
node-graph/interpreted-executor/benches/update_executor.rs
Normal file
28
node-graph/interpreted-executor/benches/update_executor.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use graph_craft::proto::ProtoNetwork;
|
||||
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||
|
||||
mod benchmark_util;
|
||||
use benchmark_util::{bench_for_each_demo, setup_network};
|
||||
|
||||
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(
|
||||
|| {
|
||||
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(criterion::black_box(network))),
|
||||
criterion::BatchSize::SmallInput,
|
||||
)
|
||||
});
|
||||
});
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, update_executor);
|
||||
criterion_main!(benches);
|
||||
Reference in New Issue
Block a user