mirror of
https://github.com/alfg/mp4-rust.git
synced 2024-12-22 20:16:27 +00:00
22 lines
No EOL
572 B
Rust
22 lines
No EOL
572 B
Rust
use criterion::BenchmarkId;
|
|
use criterion::{criterion_group, criterion_main, Criterion};
|
|
use mp4;
|
|
use std::fs::File;
|
|
|
|
fn read_mp4(filename: &str) -> u64 {
|
|
let f = File::open(filename).unwrap();
|
|
let m = mp4::read_mp4(f).unwrap();
|
|
let size = m.size();
|
|
size
|
|
}
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
let filename = "tests/samples/minimal.mp4";
|
|
|
|
c.bench_with_input(BenchmarkId::new("input_example", filename), &filename, |b, &s| {
|
|
b.iter(|| read_mp4(s));
|
|
});
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches); |