File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ edition = "2021"
99
1010[dev-dependencies ]
1111criterion = { version = " 0.5" , features = [" html_reports" ] }
12- maybe_xml = " 0.3 "
12+ maybe_xml = " 0.6 "
1313quick-xml = { path = " .." , features = [" serialize" ] }
1414rapid-xml = " 0.2"
1515rusty_xml = { version = " 0.3" , package = " RustyXML" }
Original file line number Diff line number Diff 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 } )
You can’t perform that action at this time.
0 commit comments