@@ -24,7 +24,7 @@ impl TokenSink for Sink {
2424}
2525
2626
27- fn run_bench ( c : & mut Criterion , name : & str , opts : TokenizerOpts ) {
27+ fn run_bench ( c : & mut Criterion , name : & str ) {
2828 let mut path = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
2929 path. push ( "data/bench/" ) ;
3030 path. push ( name) ;
@@ -49,13 +49,10 @@ fn run_bench(c: &mut Criterion, name: &str, opts: TokenizerOpts) {
4949 total += sz;
5050 }
5151
52- let mut test_name = String :: new ( ) ;
53- test_name. push_str ( "tokenizing" ) ;
54- test_name. push_str ( " " ) ;
55- test_name. push_str ( name) ;
52+ let test_name = format ! ( "html tokenizing {}" , name) ;
5653
5754 c. bench_function ( & test_name, move |b| b. iter ( || {
58- let mut tok = Tokenizer :: new ( Sink , opts . clone ( ) ) ;
55+ let mut tok = Tokenizer :: new ( Sink , Default :: default ( ) ) ;
5956 let mut buffer = BufferQueue :: new ( ) ;
6057 // We are doing clone inside the bench function, this is not ideal, but possibly
6158 // necessary since our iterator consumes the underlying buffer.
@@ -71,12 +68,12 @@ fn run_bench(c: &mut Criterion, name: &str, opts: TokenizerOpts) {
7168
7269
7370fn html5ever_benchmark ( c : & mut Criterion ) {
74- run_bench ( c, "lipsum.html" , Default :: default ( ) ) ;
75- run_bench ( c, "lipsum-zh.html" , Default :: default ( ) ) ;
76- run_bench ( c, "medium-fragment.html" , Default :: default ( ) ) ;
77- run_bench ( c, "small-fragment.html" , Default :: default ( ) ) ;
78- run_bench ( c, "tiny-fragment.html" , Default :: default ( ) ) ;
79- run_bench ( c, "strong.html" , Default :: default ( ) ) ;
71+ run_bench ( c, "lipsum.html" ) ;
72+ run_bench ( c, "lipsum-zh.html" ) ;
73+ run_bench ( c, "medium-fragment.html" ) ;
74+ run_bench ( c, "small-fragment.html" ) ;
75+ run_bench ( c, "tiny-fragment.html" ) ;
76+ run_bench ( c, "strong.html" ) ;
8077}
8178
8279criterion_group ! ( benches, html5ever_benchmark) ;
0 commit comments