summaryrefslogtreecommitdiff
path: root/chomp-bench/benches/arith.rs
diff options
context:
space:
mode:
authorGreg Brown <gmb60@cam.ac.uk>2021-04-20 11:54:40 +0100
committerGreg Brown <gmb60@cam.ac.uk>2021-04-20 11:54:40 +0100
commit15f5491028b11bd821bd141183e8b5bf8c1c46af (patch)
tree02a688b9baf9e4e6b11d83b9d76b95bb363e66ce /chomp-bench/benches/arith.rs
parent7934aa9af22e8fa3c33a45bc08e732a73c0cabf5 (diff)
Add handwritten arithmetic parser.
Diffstat (limited to 'chomp-bench/benches/arith.rs')
-rw-r--r--chomp-bench/benches/arith.rs7
1 files changed, 7 insertions, 0 deletions
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))
+ });
}
}