diff options
author | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-07-19 15:37:58 +0300 |
commit | a990de90fe41456a23e58bd087d2f107d321f3a1 (patch) | |
tree | 15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/png/benches/decoder.rs | |
parent | 3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff) | |
download | fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip |
Deleted vendor folder
Diffstat (limited to 'vendor/png/benches/decoder.rs')
-rw-r--r-- | vendor/png/benches/decoder.rs | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/vendor/png/benches/decoder.rs b/vendor/png/benches/decoder.rs deleted file mode 100644 index a078c9a..0000000 --- a/vendor/png/benches/decoder.rs +++ /dev/null @@ -1,38 +0,0 @@ -use std::fs; - -use criterion::{criterion_group, criterion_main, Criterion, Throughput}; -use png::Decoder; - -fn load_all(c: &mut Criterion) { - for entry in fs::read_dir("tests/benches/").unwrap().flatten() { - match entry.path().extension() { - Some(st) if st == "png" => {} - _ => continue, - } - - let data = fs::read(entry.path()).unwrap(); - bench_file(c, data, entry.file_name().into_string().unwrap()); - } -} - -criterion_group!(benches, load_all); -criterion_main!(benches); - -fn bench_file(c: &mut Criterion, data: Vec<u8>, name: String) { - let mut group = c.benchmark_group("decode"); - group.sample_size(20); - - let decoder = Decoder::new(&*data); - let mut reader = decoder.read_info().unwrap(); - let mut image = vec![0; reader.output_buffer_size()]; - let info = reader.next_frame(&mut image).unwrap(); - - group.throughput(Throughput::Bytes(info.buffer_size() as u64)); - group.bench_with_input(name, &data, |b, data| { - b.iter(|| { - let decoder = Decoder::new(data.as_slice()); - let mut decoder = decoder.read_info().unwrap(); - decoder.next_frame(&mut image).unwrap(); - }) - }); -} |