summaryrefslogtreecommitdiff
path: root/benches
diff options
context:
space:
mode:
Diffstat (limited to 'benches')
-rw-r--r--benches/html5ever.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/benches/html5ever.rs b/benches/html5ever.rs
index ff20c4f..9f4b815 100644
--- a/benches/html5ever.rs
+++ b/benches/html5ever.rs
@@ -2,12 +2,10 @@
extern crate criterion;
extern crate html5ever;
-use std::fs;
use std::path::PathBuf;
use criterion::{black_box, Criterion};
-use html5ever::tendril::*;
use html5ever::tokenizer::{BufferQueue, Token, TokenSink, TokenSinkResult, Tokenizer};
struct Sink;
@@ -27,14 +25,7 @@ fn run_bench(c: &mut Criterion, name: &str) {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("data/bench/");
path.push(name);
- let mut file = fs::File::open(&path).ok().expect("can't open file");
-
- // Read the file and treat it as an infinitely repeating sequence of characters.
- let mut file_input = ByteTendril::new();
- file.read_to_tendril(&mut file_input)
- .ok()
- .expect("can't read file");
- let file_input: StrTendril = file_input.try_reinterpret().unwrap();
+ let file_input: String = std::fs::read_to_string(&path).expect("can't open file");
let size = file_input.len();
let mut stream = file_input.chars().cycle();
@@ -46,7 +37,7 @@ fn run_bench(c: &mut Criterion, name: &str) {
// The by_ref() call is important, otherwise we get wrong results!
// See rust-lang/rust#18045.
let sz = std::cmp::min(1024, size - total);
- input.push(stream.by_ref().take(sz).collect::<String>().to_tendril());
+ input.push(stream.by_ref().take(sz).collect::<String>());
total += sz;
}