diff --git a/benches/parsing.rs b/benches/parsing.rs index f7e3da0..35de7ae 100644 --- a/benches/parsing.rs +++ b/benches/parsing.rs @@ -23,5 +23,26 @@ fn parsing_benchmark(c: &mut Criterion) { } } -criterion_group!(benches, parsing_benchmark); +fn parsing_nested(c: &mut Criterion) { + let mut parsing = c.benchmark_group("Parsing"); + + for size in [1, 2, 8, 12] { + let mut input = String::new(); + + for _ in 0..size { + input = format!( + "{{{{ for foo in bar }}}} {input} {{{{ if foo }}}} Hi! {input} {{{{ end }}}} Yooo {{{{ end }}}}" + ); + } + + let input = NomoInput::from(input); + + parsing.throughput(criterion::Throughput::Bytes(input.len() as u64)); + parsing.bench_with_input(BenchmarkId::from_parameter(size), &input, |b, input| { + b.iter(|| nomo::parser::parse(input.clone()).unwrap()); + }); + } +} + +criterion_group!(benches, parsing_benchmark, parsing_nested); criterion_main!(benches); diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 2b28a53..ee307ed 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -116,7 +116,6 @@ version = "0.1.0" dependencies = [ "annotate-snippets", "displaydoc", - "serde", "serde_json", "thiserror", "winnow", @@ -161,7 +160,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", - "serde_derive", ] [[package]]