Skip to content

Commit b9a0fa2

Browse files
committed
Update maybe_xml dependency 0.3 -> 0.6
1 parent 7fbe4bc commit b9a0fa2

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

compare/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2021"
99

1010
[dev-dependencies]
1111
criterion = { version = "0.5", features = ["html_reports"] }
12-
maybe_xml = "0.3"
12+
maybe_xml = "0.6"
1313
quick-xml = { path = "..", features = ["serialize"] }
1414
rapid-xml = "0.2"
1515
rusty_xml = { version = "0.3", package = "RustyXML" }

compare/benches/bench.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,18 @@ fn low_level_comparison(c: &mut Criterion) {
7979
BenchmarkId::new("maybe_xml", filename),
8080
*data,
8181
|b, input| {
82-
use maybe_xml::eval::recv::Evaluator;
83-
use maybe_xml::token::borrowed::Token;
82+
use maybe_xml::Lexer;
83+
use maybe_xml::token::Ty;
8484

8585
b.iter(|| {
86-
let mut input = input.as_bytes();
87-
let mut eval = Evaluator::new();
86+
let lexer = Lexer::from_slice(input.as_bytes());
8887

8988
let mut count = criterion::black_box(0);
90-
loop {
91-
let consumed = eval.recv(input);
92-
match eval.next_token() {
93-
Ok(Some(Token::StartTag(_))) => count += 1,
94-
Ok(Some(Token::EmptyElementTag(_))) => count += 1,
95-
Ok(Some(Token::Eof)) => break,
96-
Ok(Some(Token::EofWithBytesNotEvaluated(_))) => break,
89+
for token in lexer.into_iter() {
90+
match token.ty() {
91+
Ty::StartTag(_) | Ty::EmptyElementTag(_) => count += 1,
9792
_ => (),
9893
}
99-
input = &input[consumed..];
10094
}
10195
assert_eq!(count, total_tags, "Overall tag count in {}", filename);
10296
})

0 commit comments

Comments
 (0)