mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 15:28:04 +08:00
* replace deprecated criterion::black_box with std::hint::black_box * gemini code review suggestions Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * apply formating --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
18 lines
549 B
Rust
18 lines
549 B
Rust
use std::hint::black_box;
|
|
|
|
use criterion::{Criterion, criterion_group, criterion_main};
|
|
use graph_craft::util::DEMO_ART;
|
|
|
|
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));
|
|
}
|
|
}
|
|
|
|
criterion_group!(benches, compile_to_proto);
|
|
criterion_main!(benches);
|