From b9a0fa271bdade22f195963f810e46cd5785df7c Mon Sep 17 00:00:00 2001 From: Mingun Date: Tue, 17 Oct 2023 21:26:58 +0500 Subject: [PATCH] Update maybe_xml dependency 0.3 -> 0.6 --- compare/Cargo.toml | 2 +- compare/benches/bench.rs | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/compare/Cargo.toml b/compare/Cargo.toml index 5c7ecb64..8390b31e 100644 --- a/compare/Cargo.toml +++ b/compare/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [dev-dependencies] criterion = { version = "0.5", features = ["html_reports"] } -maybe_xml = "0.3" +maybe_xml = "0.6" quick-xml = { path = "..", features = ["serialize"] } rapid-xml = "0.2" rusty_xml = { version = "0.3", package = "RustyXML" } diff --git a/compare/benches/bench.rs b/compare/benches/bench.rs index 8b2a736f..9ec1a968 100644 --- a/compare/benches/bench.rs +++ b/compare/benches/bench.rs @@ -79,24 +79,18 @@ fn low_level_comparison(c: &mut Criterion) { BenchmarkId::new("maybe_xml", filename), *data, |b, input| { - use maybe_xml::eval::recv::Evaluator; - use maybe_xml::token::borrowed::Token; + use maybe_xml::Lexer; + use maybe_xml::token::Ty; b.iter(|| { - let mut input = input.as_bytes(); - let mut eval = Evaluator::new(); + let lexer = Lexer::from_slice(input.as_bytes()); let mut count = criterion::black_box(0); - loop { - let consumed = eval.recv(input); - match eval.next_token() { - Ok(Some(Token::StartTag(_))) => count += 1, - Ok(Some(Token::EmptyElementTag(_))) => count += 1, - Ok(Some(Token::Eof)) => break, - Ok(Some(Token::EofWithBytesNotEvaluated(_))) => break, + for token in lexer.into_iter() { + match token.ty() { + Ty::StartTag(_) | Ty::EmptyElementTag(_) => count += 1, _ => (), } - input = &input[consumed..]; } assert_eq!(count, total_tags, "Overall tag count in {}", filename); })