From da68a1b17c45a004224865c43a9ba687f1512efe Mon Sep 17 00:00:00 2001 From: torfmaster Date: Sun, 4 Aug 2024 13:37:21 +0200 Subject: [PATCH] add benchmark for fast_blur --- Cargo.toml | 10 ++++++++++ benches/blur.rs | 13 +++++++++++++ benches/fast_blur.rs | 13 +++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 benches/blur.rs create mode 100644 benches/fast_blur.rs diff --git a/Cargo.toml b/Cargo.toml index aefb3ba6c2..3e13c1c00e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/benches/blur.rs b/benches/blur.rs new file mode 100644 index 0000000000..29ba6dec21 --- /dev/null +++ b/benches/blur.rs @@ -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); diff --git a/benches/fast_blur.rs b/benches/fast_blur.rs new file mode 100644 index 0000000000..10f547545d --- /dev/null +++ b/benches/fast_blur.rs @@ -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);