use crabrl::Parser; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use std::path::Path; fn parse_sample_sec_file(c: &mut Criterion) { let parser = Parser::new(); let sample_file = Path::new("fixtures/sample-sec.xml"); if sample_file.exists() { c.bench_function("parse_sample_sec", |b| { b.iter(|| parser.parse_file(black_box(&sample_file))); }); } else { // If no fixtures exist, use a minimal inline XBRL for benchmarking let minimal_xbrl = r#" 0000000000 2023-12-31 iso4217:USD "#; c.bench_function("parse_minimal", |b| { b.iter(|| parser.parse_str(black_box(minimal_xbrl))); }); } } criterion_group!(benches, parse_sample_sec_file); criterion_main!(benches);