fast image operations
Diffstat (limited to 'benches/affine_transformations.rs')
| -rw-r--r-- | benches/affine_transformations.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/benches/affine_transformations.rs b/benches/affine_transformations.rs index 74742e1..0899900 100644 --- a/benches/affine_transformations.rs +++ b/benches/affine_transformations.rs @@ -1,7 +1,7 @@ use fimg::*; macro_rules! bench { - (fn $name: ident() { run $fn: ident() }) => { + (fn $name: ident() { run $fn: ident() } $($namec:ident)?) => { fn $name() { let mut img: Image<_, 4> = Image::build(128, 128).buf(include_bytes!("4_128x128.imgbuf").to_vec()); @@ -12,12 +12,24 @@ macro_rules! bench { }; } } + + $(fn $namec() { + let img: Image<&[u8], 4> = + Image::build(128, 128).buf(include_bytes!("4_128x128.imgbuf")); + #[allow(unused_unsafe)] + unsafe { + std::hint::black_box(img.cloner().$fn()) + }; + })? }; } -bench!(fn flip_h() { run flip_h() }); -bench!(fn flip_v() { run flip_v() }); -bench!(fn rotate_90() { run rot_90() }); -bench!(fn rotate_180() { run rot_180() }); -bench!(fn rotate_270() { run rot_270() }); -iai::main!(flip_h, flip_v, rotate_90, rotate_180, rotate_270); +bench!(fn flip_h() { run flip_h() } flip_hc); +bench!(fn flip_v() { run flip_v() } flip_vc); +bench!(fn rotate_90() { run rot_90() } rot_90c); +bench!(fn rotate_180() { run rot_180() } rot_180c); +bench!(fn rotate_270() { run rot_270() } rot_280c); +iai::main!( + flip_h, flip_v, rotate_90, rotate_180, rotate_270, flip_hc, flip_vc, rot_90c, rot_180c, + rot_280c +); |