blob: 1ae8c0d0bc9fdc49a8e78911aebbc78385cd8af2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#[macro_use]
extern crate bencher;
extern crate exr;
use exr::prelude::*;
use bencher::Bencher;
use std::fs;
use std::io::Cursor;
use exr::image::pixel_vec::PixelVec;
const PROFILING_REPETITIONS: i32 = 1; // make this 100 for profiling longer periods
/// This is a suuuper long benchmark, to allow you to hook up a profiler while running it
/// but this means we don't want it in our normal benchmarks
fn read_single_image_from_buffer_rgba_f32_as_f16(bench: &mut Bencher) {
let mut file = fs::read("tests/images/valid/custom/crowskull/crow_uncompressed.exr").unwrap();
bencher::black_box(&mut file);
bench.iter(||{
for _ in 0 .. PROFILING_REPETITIONS {
let image = exr::prelude::read()
.no_deep_data().largest_resolution_level()
.rgba_channels(PixelVec::<(f16,f16,f16,f16)>::constructor, PixelVec::set_pixel)
.first_valid_layer().all_attributes()
.non_parallel()
.from_buffered(Cursor::new(file.as_slice())).unwrap();
bencher::black_box(image);
}
})
}
benchmark_group!(profiling,
read_single_image_from_buffer_rgba_f32_as_f16
);
benchmark_main!(profiling);
|