use criterion::*; use std::fs::read_to_string; use std::hint::black_box; use wmap_parser::*; fn bench(c: &mut Criterion) { let mut group = c.benchmark_group("Parsing"); let example_source = read_to_string("doc/example.wmap").unwrap(); let huge_source = read_to_string("doc/huge.wmap").unwrap(); group.sample_size(500); group.bench_function("parse example", |b| { b.iter(|| parse(black_box(&example_source))) }); group.bench_function("parse huge", |b| b.iter(|| parse(black_box(&huge_source)))); group.finish(); } criterion_group!(benches, bench); criterion_main!(benches);