| 28 | } |
| 29 | |
| 30 | fn parse_sheet(c: &mut Criterion) { |
| 31 | let mut group = c.benchmark_group("parse_sheet"); |
| 32 | for file in get_files() { |
| 33 | group.throughput(Throughput::Bytes(file.source_text.len() as u64)); |
| 34 | group.bench_with_input(BenchmarkId::from_parameter(&file.name), &file.source_text, |b, source_text| { |
| 35 | b.iter_with_large_drop(|| { |
| 36 | let allocator = Bump::default(); |
| 37 | let lexer = Lexer::new(&CsskitAtomSet::ATOMS, &source_text); |
| 38 | let _ = Parser::new(&allocator, source_text, lexer).parse_entirely::<Sheet>(); |
| 39 | |
| 40 | allocator |
| 41 | }); |
| 42 | }); |
| 43 | } |
| 44 | group.finish(); |
| 45 | } |
| 46 | |
| 47 | #[cfg(target_family = "unix")] |
| 48 | criterion_group! { |