Fix compilation for compile benchmarks

This commit is contained in:
Dennis Kobert
2025-12-21 22:53:07 +01:00
parent 7d3efffdac
commit e176a0b812
8 changed files with 17 additions and 15 deletions
@@ -1,12 +1,15 @@
use criterion::{Criterion, black_box, criterion_group, criterion_main};
use criterion::{Criterion, criterion_group, criterion_main};
use graph_craft::util::DEMO_ART;
use std::hint::black_box;
fn compile_to_proto(c: &mut Criterion) {
use graph_craft::util::{compile, load_from_name};
let mut c = c.benchmark_group("Compile Network cold");
for name in DEMO_ART {
let network = load_from_name(name);
c.bench_function(name, |b| b.iter_batched(|| network.clone(), |network| compile(black_box(network)), criterion::BatchSize::SmallInput));
c.bench_function(name, |b| {
b.iter_batched(|| network.clone(), |network| compile(black_box(network), None), criterion::BatchSize::SmallInput)
});
}
}
@@ -5,7 +5,7 @@ use iai_callgrind::{library_benchmark, library_benchmark_group, main};
#[library_benchmark]
#[benches::with_setup(args = ["isometric-fountain", "painted-dreams", "procedural-string-lights", "parametric-dunescape", "red-dress", "valley-of-spires"], setup = load_from_name)]
pub fn compile_to_proto(_input: NodeNetwork) {
std::hint::black_box(compile(_input));
std::hint::black_box(compile(_input, None));
}
library_benchmark_group!(name = compile_group; benchmarks = compile_to_proto);