benchmarks comparing the rust image processing ecosystem
-rw-r--r--Cargo.toml1
-rw-r--r--benches/blur.rs24
-rw-r--r--blur.svg2
3 files changed, 19 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 5671a14..16f6635 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,6 +16,7 @@ imageproc = { version = "0.23.0", default-features = false }
opencv = "0.86.1"
resize = { version = "0.8.2", default-features = false, features = ["std"] }
rgb = "0.8.37"
+stackblur-iter = { version = "0.2.0", features = ["simd"] }
umath = "0.0.7"
[patch.crates-io]
diff --git a/benches/blur.rs b/benches/blur.rs
index 211dc9d..d87b576 100644
--- a/benches/blur.rs
+++ b/benches/blur.rs
@@ -87,13 +87,23 @@ pub fn blud() {
}
pub fn fimg() {
- let mut i = Image::<_, 3>::build(SIZE, SIZE).buf(iai::black_box(
- include_bytes!("../small_data.imgbuf")
- .to_vec()
- .into_boxed_slice(),
- ));
- i.blur(30);
+ let mut i: Image<Box<[u32]>, 1> = Image::<_, 3>::build(SIZE, SIZE)
+ .buf(iai::black_box(&include_bytes!("../small_data.imgbuf")[..]))
+ .into();
+ i.blur_argb(30);
+ iai::black_box(&i);
+}
+
+pub fn stackblur() {
+ let i: Image<Box<[u32]>, 1> = Image::<_, 3>::build(SIZE, SIZE)
+ .buf(iai::black_box(&include_bytes!("../small_data.imgbuf")[..]))
+ .into();
+ let mut i = i.take_buffer().to_vec();
+ stackblur_iter::simd_blur_argb::<8>(
+ &mut stackblur_iter::imgref::ImgRefMut::new(&mut i, SIZE as usize, SIZE as usize),
+ 30,
+ );
iai::black_box(&i);
}
-iai::main!(blud, imageproc, fimg, image, fastblur, opencv);
+iai::main!(blud, imageproc, fimg, image, fastblur, opencv, stackblur);
diff --git a/blur.svg b/blur.svg
index 9f23af8..8622426 100644
--- a/blur.svg
+++ b/blur.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="480" height="480"><path fill="#0d1117" d="M0 0h480v480H0z"/><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 463.22h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 463.22h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 467.12)"><tspan> 0</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 413.19h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 413.19h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 417.09)"><tspan> 1x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 363.17h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 363.17h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 367.07)"><tspan> 2x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 313.14h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 313.14h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 317.04)"><tspan> 3x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 263.11h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 263.11h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 267.01)"><tspan> 4x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 213.09h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 213.09h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 216.99)"><tspan> 5x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 163.06h211.06m146.06 0h8.39" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 163.06h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 166.96)"><tspan> 6x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 113.04h211.06m146.06 0h8.39" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 113.04h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 116.94)"><tspan> 7x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 63.01h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 63.01h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 66.91)"><tspan> 8x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#E6EDF3" d="M89.31 63.01v400.21h365.51V63.01H89.31Z" color="#000"/><text fill="#E6EDF3" color="#000" font-family="Verdana" font-size="18" text-anchor="middle" transform="rotate(-90 142.125 120.995)"><tspan>cycles</tspan></text><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 87.06)"><tspan>fimg</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#73D0FF" stroke="none" d="M388.48 87.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 87.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#73D0FF" stroke="none" d="M180.69 463.22h30.47v-33.78h-30.47z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M180.69 463.22v-33.77h30.46v33.77h-30.46Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 108.06)"><tspan>imgproc</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#FFD173" stroke="none" d="M388.48 108.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 108.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#FFD173" stroke="none" d="M211.15 463.22h30.47V140.44h-30.47z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M211.15 463.22V140.45h30.46v322.77h-30.46Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 129.06)"><tspan>image</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#D5FF80" stroke="none" d="M388.48 129.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 129.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#D5FF80" stroke="none" d="M241.61 463.22h30.47V98.34h-30.47z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M241.61 463.22V98.35h30.46v364.87h-30.46Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 150.06)"><tspan>blud</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#F27983" stroke="none" d="M388.48 150.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 150.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#F27983" stroke="none" d="M272.07 463.22h30.46V429.3h-30.46z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M272.07 463.22v-33.91h30.45v33.91h-30.45Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 171.06)"><tspan>fastblur</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#DFBFFF" stroke="none" d="M388.48 171.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 171.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#DFBFFF" stroke="none" d="M302.52 463.22h30.47v-43.99h-30.47z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M302.52 463.22v-43.98h30.46v43.98h-30.46Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 192.06)"><tspan>opencv</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#BFBDB6" stroke="none" d="M388.48 192.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 192.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#BFBDB6" stroke="none" d="M332.98 463.22h30.47V353.69h-30.47z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M332.98 463.22V353.7h30.46v109.52h-30.46Z"/></g><path fill="none" stroke="#E6EDF3" d="M89.31 63.01v400.21h365.51V63.01H89.31Z" color="#000"/><text fill="#E6EDF3" color="#000" font-family="Verdana" font-size="18" text-anchor="middle" transform="translate(272.06 32.86)"><tspan>gaussian blur</tspan></text></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="480" height="480"><path fill="#0d1117" d="M0 0h480v480H0z"/><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 463.22h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 463.22h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 467.12)"><tspan> 0</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 413.19h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 413.19h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 417.09)"><tspan> 1x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 363.17h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 363.17h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 367.07)"><tspan> 2x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 313.14h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 313.14h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 317.04)"><tspan> 3x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 263.11h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 263.11h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 267.01)"><tspan> 4x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 213.09h201.27m155.85 0h8.39" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 213.09h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 216.99)"><tspan> 5x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 163.06h201.27m155.85 0h8.39" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 163.06h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 166.96)"><tspan> 6x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 113.04h201.27m155.85 0h8.39" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 113.04h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 116.94)"><tspan> 7x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#1F2430" stroke-dasharray="5,8" stroke-width="2" d="M89.31 63.01h365.51" class="gridline" color="#000"/><g fill="none" stroke="currentColor" color="#000"><path stroke="#E6EDF3" d="M89.31 63.01h9m356.51 0h-9"/><text fill="#E6EDF3" stroke="none" font-family="Arial" font-size="12" text-anchor="end" transform="translate(80.92 66.91)"><tspan> 8x10</tspan><tspan dy="-6" font-size="9.6">9</tspan></text></g><path fill="none" stroke="#E6EDF3" d="M89.31 63.01v400.21h365.51V63.01H89.31Z" color="#000"/><text fill="#E6EDF3" color="#000" font-family="Verdana" font-size="18" text-anchor="middle" transform="rotate(-90 142.125 120.995)"><tspan>cycles</tspan></text><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 87.06)"><tspan>fimg</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#73D0FF" stroke="none" d="M388.48 87.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 87.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#73D0FF" stroke="none" d="M180.69 463.22h26.12v-29.29h-26.12z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M180.69 463.22v-29.28h26.11v29.28h-26.11Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 108.06)"><tspan>imgproc</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#FFD173" stroke="none" d="M388.48 108.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 108.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#FFD173" stroke="none" d="M206.8 463.22h26.11V140.44H206.8z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M206.8 463.22V140.45h26.1v322.77h-26.1Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 129.06)"><tspan>image</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#D5FF80" stroke="none" d="M388.48 129.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 129.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#D5FF80" stroke="none" d="M232.9 463.22h26.12V98.34H232.9z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M232.9 463.22V98.35h26.11v364.87H232.9Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 150.06)"><tspan>blud</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#F27983" stroke="none" d="M388.48 150.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 150.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#F27983" stroke="none" d="M259.01 463.22h26.12V429.3h-26.12z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M259.01 463.22v-33.91h26.11v33.91h-26.11Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 171.06)"><tspan>fastblur</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#DFBFFF" stroke="none" d="M388.48 171.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 171.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#DFBFFF" stroke="none" d="M285.12 463.22h26.12v-43.99h-26.12z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M285.12 463.22v-43.98h26.11v43.98h-26.11Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 192.06)"><tspan>opencv</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#BFBDB6" stroke="none" d="M388.48 192.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 192.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#BFBDB6" stroke="none" d="M311.23 463.22h26.11V353.69h-26.11z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M311.23 463.22V353.7h26.1v109.52h-26.1Z"/></g><text fill="#E6EDF3" stroke-width="2" color="#000" font-family="Verdana" font-size="14" text-anchor="end" transform="translate(378.69 213.06)"><tspan>stackblur</tspan></text><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#F66" stroke="none" d="M388.48 213.76h48.16v-10.5h-48.16z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M388.48 213.76h48.16v-10.5h-48.16v10.5Z"/></g><g fill="none" stroke="currentColor" stroke-width="2" color="#000"><path fill="#F66" stroke="none" d="M337.33 463.22h26.12v-33.27h-26.12z" shape-rendering="crispEdges"/><path stroke="#1A1F29" d="M337.33 463.22v-33.26h26.11v33.26h-26.11Z"/></g><path fill="none" stroke="#E6EDF3" d="M89.31 63.01v400.21h365.51V63.01H89.31Z" color="#000"/><text fill="#E6EDF3" color="#000" font-family="Verdana" font-size="18" text-anchor="middle" transform="translate(272.06 32.86)"><tspan>gaussian blur</tspan></text></svg> \ No newline at end of file