1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-11-14 19:21:01 +00:00
mp4-rust/benches/bench_main.rs
Data Retriever 3ecfd0cc9d
Cargo fmt and clippy (#73)
* Run cargo clippy --fix

* Run cargo fmt --all
2022-05-31 20:50:49 -07:00

26 lines
584 B
Rust

use criterion::BenchmarkId;
use criterion::{criterion_group, criterion_main, Criterion};
use std::fs::File;
fn read_mp4(filename: &str) -> u64 {
let f = File::open(filename).unwrap();
let m = mp4::read_mp4(f).unwrap();
m.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);