@@ -24,7 +24,7 @@ impl TokenSink for Sink {
24
24
}
25
25
26
26
27
- fn run_bench ( c : & mut Criterion , name : & str , opts : TokenizerOpts ) {
27
+ fn run_bench ( c : & mut Criterion , name : & str ) {
28
28
let mut path = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
29
29
path. push ( "data/bench/" ) ;
30
30
path. push ( name) ;
@@ -49,13 +49,10 @@ fn run_bench(c: &mut Criterion, name: &str, opts: TokenizerOpts) {
49
49
total += sz;
50
50
}
51
51
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) ;
56
53
57
54
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 ( ) ) ;
59
56
let mut buffer = BufferQueue :: new ( ) ;
60
57
// We are doing clone inside the bench function, this is not ideal, but possibly
61
58
// necessary since our iterator consumes the underlying buffer.
@@ -71,12 +68,12 @@ fn run_bench(c: &mut Criterion, name: &str, opts: TokenizerOpts) {
71
68
72
69
73
70
fn 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" ) ;
80
77
}
81
78
82
79
criterion_group ! ( benches, html5ever_benchmark) ;
0 commit comments