34 lines
994 B
Rust
34 lines
994 B
Rust
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
|
|
use std::io::Cursor;
|
|
use wxbox_ar2::parse::Ar2v;
|
|
|
|
const KCRP20170825_235733_V06: (&[u8], &str) = (
|
|
include_bytes!("KCRP20170825_235733_V06"),
|
|
"KCRP20170825_235733_V06",
|
|
);
|
|
const KGWX20250518_165333_V06: (&[u8], &str) = (
|
|
include_bytes!("KGWX20250518_165333_V06"),
|
|
"KGWX20250518_165333_V06",
|
|
);
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
let mut group = c.benchmark_group("parse");
|
|
|
|
for (test_file_bytes, name) in [KCRP20170825_235733_V06, KGWX20250518_165333_V06].iter() {
|
|
group.bench_with_input(
|
|
BenchmarkId::from_parameter(name),
|
|
test_file_bytes,
|
|
|b, bytes| {
|
|
b.iter(|| {
|
|
let mut r = Cursor::new(bytes.to_vec());
|
|
Ar2v::read(&mut r).unwrap();
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
group.finish();
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches);
|