Skip to content

Commit

Permalink
add benchmark for fast_blur
Browse files Browse the repository at this point in the history
  • Loading branch information
torfmaster committed Aug 4, 2024
1 parent 23ee9a3 commit da68a1b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,13 @@ harness = false
[[bench]]
name = "copy_from"
harness = false

[[bench]]
path = "benches/fast_blur.rs"
name = "fast_blur"
harness = false

[[bench]]
path = "benches/blur.rs"
name = "blur"
harness = false
13 changes: 13 additions & 0 deletions benches/blur.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use criterion::{criterion_group, criterion_main, Criterion};
use image::{imageops::blur, ImageBuffer, Rgb};

pub fn bench_fast_blur(c: &mut Criterion) {
let src = ImageBuffer::from_pixel(1024, 768, Rgb([255u8, 0, 0]));

c.bench_function("blur", |b| {
b.iter(|| blur(&src, 50.0));
});
}

criterion_group!(benches, bench_fast_blur);
criterion_main!(benches);
13 changes: 13 additions & 0 deletions benches/fast_blur.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use criterion::{criterion_group, criterion_main, Criterion};
use image::{imageops::fast_blur, ImageBuffer, Rgb};

pub fn bench_fast_blur(c: &mut Criterion) {
let src = ImageBuffer::from_pixel(1024, 768, Rgb([255u8, 0, 0]));

c.bench_function("fast_blur", |b| {
b.iter(|| fast_blur(&src, 50.0));
});
}

criterion_group!(benches, bench_fast_blur);
criterion_main!(benches);

0 comments on commit da68a1b

Please sign in to comment.