diff --git a/src/benches/parse.rs b/src/benches/parse.rs index 56ccf61..3c05de0 100644 --- a/src/benches/parse.rs +++ b/src/benches/parse.rs @@ -9,23 +9,7 @@ extern crate ucglib; use bencher::Bencher; //use cpuprofiler::PROFILER; -macro_rules! bench_parse { - ($parsemac:ident($i:expr), $b:expr) => { - bench_parse!($i, $parsemac, $b) - }; - ($i:expr, $f:expr, $b:expr) => { - let input = nom_locate::LocatedSpan::new($i); - let val = tokenize(input).unwrap(); - $b.iter(|| { - $f(TokenIter { - source: val.as_slice(), - }) - }); - }; -} - use ucglib::parse::*; -use ucglib::tokenizer::*; fn do_parse(i: &str) { parse(nom_locate::LocatedSpan::new(i)); @@ -81,7 +65,6 @@ fn parse_complex_tuple_list(b: &mut Bencher) { // .unwrap(); let input = "[{foo=1}, {bar=2}, {quux=4}];"; b.iter(|| do_parse(input)); - //bench_parse!(non_op_expression(input), b); //PROFILER.lock().unwrap().stop().unwrap(); } @@ -93,7 +76,6 @@ fn parse_complex_nested_list(b: &mut Bencher) { // .unwrap(); let input = "[[1,2], [3,4], [4,5]];"; b.iter(|| do_parse(input)); - //bench_parse!(non_op_expression(input), b); //PROFILER.lock().unwrap().stop().unwrap(); } diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 00d1ed8..efe18dc 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -744,11 +744,6 @@ named!(pub non_op_expression, trace_nom!(simple_expression)) ); -// TODO(jwall): Because we have to parse an op_expression before a non_op_expression -// this parser is really slow. The reason is that the op_expression is unable to fail -// quickly enough and wastes a lot of parsing time before it realizes that this is not -// an operator expression. Fixing this probably means hand rolling this parsing -// function so we can identify early whether this is an op_expression or not. named!(pub expression, alt_complete!(trace_nom!(op_expression) | trace_nom!(non_op_expression)) );