From 15f5491028b11bd821bd141183e8b5bf8c1c46af Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Tue, 20 Apr 2021 11:54:40 +0100 Subject: Add handwritten arithmetic parser. --- chomp-bench/benches/arith.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'chomp-bench/benches') diff --git a/chomp-bench/benches/arith.rs b/chomp-bench/benches/arith.rs index 4ba6ea7..489a847 100644 --- a/chomp-bench/benches/arith.rs +++ b/chomp-bench/benches/arith.rs @@ -24,6 +24,10 @@ fn parse_chewed(input: &str) -> i64 { .into() } +fn parse_handwritten(input: &str) -> i64 { + parse_expr(&mut IterWrapper::new(input.chars())).unwrap() +} + fn bench_parse(c: &mut Criterion) { let plot_config = PlotConfiguration::default().summary_scale(AxisScale::Logarithmic); let mut group = c.benchmark_group("Arith"); @@ -33,6 +37,9 @@ fn bench_parse(c: &mut Criterion) { group.bench_with_input(BenchmarkId::new("Chewed", i), *input, |b, i| { b.iter(|| parse_chewed(i)) }); + group.bench_with_input(BenchmarkId::new("Handwritten", i), *input, |b, i| { + b.iter(|| parse_handwritten(i)) + }); } } -- cgit v1.2.3