summaryrefslogtreecommitdiff
path: root/benches/parse.rs
diff options
context:
space:
mode:
Diffstat (limited to 'benches/parse.rs')
-rw-r--r--benches/parse.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/benches/parse.rs b/benches/parse.rs
index 518e458..71abf60 100644
--- a/benches/parse.rs
+++ b/benches/parse.rs
@@ -52,8 +52,7 @@ fn bench_parse_synthetic(c: &mut Criterion) {
});
}
-fn bench_parse_file(c: &mut Criterion, mut input: Vec<u8>) {
- input.push(0);
+fn bench_parse_file(c: &mut Criterion, input: &[u8]) {
c.bench_function("parse benches/build.ninja", |b| {
b.iter(|| {
let mut parser = n2::parse::Parser::new(&input);
@@ -67,8 +66,8 @@ fn bench_parse_file(c: &mut Criterion, mut input: Vec<u8>) {
}
pub fn bench_parse(c: &mut Criterion) {
- match std::fs::read("benches/build.ninja") {
- Ok(input) => bench_parse_file(c, input),
+ match n2::scanner::read_file_with_nul("benches/build.ninja".as_ref()) {
+ Ok(input) => bench_parse_file(c, &input),
Err(err) => {
eprintln!("failed to read benches/build.ninja: {}", err);
eprintln!("using synthetic build.ninja");