Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/mft.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/benches/benchmark.rs')
-rw-r--r--src/benches/benchmark.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/benches/benchmark.rs b/src/benches/benchmark.rs
index 8d66229..8e23b5d 100644
--- a/src/benches/benchmark.rs
+++ b/src/benches/benchmark.rs
@@ -6,25 +6,17 @@ use criterion::Criterion;
use mft::MftParser;
use std::path::{Path, PathBuf};
-fn process_90_mft_records(sample: impl AsRef<Path>) {
- let parser = MftParser::from_path(sample).unwrap();
+fn process_90_mft_records(sample: &[u8]) {
+ let mut parser = MftParser::from_buffer(sample.to_vec()).unwrap();
let _: Vec<_> = parser.iter_entries().take(90).collect();
}
fn criterion_benchmark(c: &mut Criterion) {
- let sample = PathBuf::from(file!())
- .parent()
- .unwrap()
- .parent()
- .unwrap()
- .parent()
- .unwrap()
- .join("samples")
- .join("MFT");
+ let sample = include_bytes!("../../samples/MFT");
c.bench_function("read 90 records", move |b| {
- b.iter(|| process_90_mft_records(&sample))
+ b.iter(|| process_90_mft_records(sample))
});
}