2020-08-27 03:45:18 +00:00
|
|
|
use criterion::BenchmarkId;
|
|
|
|
use criterion::{criterion_group, criterion_main, Criterion};
|
2022-06-01 03:50:49 +00:00
|
|
|
|
2020-08-27 03:45:18 +00:00
|
|
|
use std::fs::File;
|
|
|
|
|
|
|
|
fn read_mp4(filename: &str) -> u64 {
|
|
|
|
let f = File::open(filename).unwrap();
|
|
|
|
let m = mp4::read_mp4(f).unwrap();
|
2022-06-01 03:50:49 +00:00
|
|
|
|
|
|
|
m.size()
|
2020-08-27 03:45:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
|
|
let filename = "tests/samples/minimal.mp4";
|
|
|
|
|
2022-06-01 03:50:49 +00:00
|
|
|
c.bench_with_input(
|
|
|
|
BenchmarkId::new("input_example", filename),
|
|
|
|
&filename,
|
|
|
|
|b, &s| {
|
|
|
|
b.iter(|| read_mp4(s));
|
|
|
|
},
|
|
|
|
);
|
2020-08-27 03:45:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
2022-06-01 03:50:49 +00:00
|
|
|
criterion_main!(benches);
|