Updated benchmark results.

This commit is contained in:
Kirill Kuzminykh
2024-05-05 16:47:16 +03:00
parent 833b25c282
commit bd5a82ab4b
8 changed files with 273 additions and 175 deletions
+20 -26
View File
@@ -55,7 +55,6 @@ Other libraries used to compare of resizing speed:
- libvips (single-threaded mode, cache disabled)
<!-- bench_compare_rgb start -->
### Resize RGB8 image (U8x3) 4928x3279 => 852x567
Pipeline:
@@ -63,21 +62,19 @@ Pipeline:
`src_image => resize => dst_image`
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 30.14 | - | 90.74 | 149.25 | 208.22 |
| resize | 7.78 | 26.82 | 53.54 | 97.38 | 144.44 |
| libvips | 7.78 | 59.56 | 18.69 | 30.36 | 39.69 |
| fir rust | 0.28 | 9.17 | 14.72 | 26.24 | 38.98 |
| fir sse4.1 | 0.28 | 4.08 | 5.79 | 10.32 | 15.94 |
| fir avx2 | 0.28 | 3.01 | 3.86 | 6.89 | 12.69 |
| image | 28.28 | - | 82.31 | 134.61 | 186.22 |
| resize | 7.83 | 26.85 | 53.70 | 97.59 | 144.79 |
| libvips | 7.76 | 59.65 | 19.83 | 30.73 | 39.80 |
| fir rust | 0.29 | 12.77 | 17.94 | 27.94 | 40.05 |
| fir sse4.1 | 0.28 | 3.99 | 5.66 | 9.86 | 15.42 |
| fir avx2 | 0.28 | 3.06 | 3.89 | 6.85 | 13.25 |
<!-- bench_compare_rgb end -->
<!-- bench_compare_rgba start -->
### Resize RGBA8 image (U8x4) 4928x3279 => 852x567
Pipeline:
@@ -86,21 +83,19 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:------:|:--------:|:-------:|:--------:|
| resize | 11.30 | 42.85 | 85.27 | 147.28 | 211.34 |
| libvips | 9.15 | 120.11 | 188.46 | 337.77 | 499.37 |
| fir rust | 0.20 | 20.69 | 27.88 | 41.83 | 56.67 |
| fir sse4.1 | 0.19 | 10.19 | 12.43 | 17.99 | 24.64 |
| fir avx2 | 0.20 | 7.55 | 8.77 | 13.45 | 20.62 |
| resize | 11.34 | 42.76 | 85.43 | 147.41 | 211.31 |
| libvips | 8.97 | 120.82 | 190.82 | 341.07 | 500.87 |
| fir rust | 0.19 | 21.79 | 28.34 | 42.24 | 56.72 |
| fir sse4.1 | 0.20 | 10.14 | 12.26 | 18.43 | 24.22 |
| fir avx2 | 0.19 | 7.44 | 8.48 | 14.10 | 21.31 |
<!-- bench_compare_rgba end -->
<!-- bench_compare_l start -->
### Resize L8 image (U8) 4928x3279 => 852x567
Pipeline:
@@ -109,17 +104,16 @@ Pipeline:
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into grayscale image with one byte per pixel.
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 27.05 | - | 58.63 | 86.87 | 115.57 |
| resize | 6.44 | 11.49 | 21.83 | 43.93 | 71.01 |
| libvips | 4.69 | 25.00 | 9.69 | 12.95 | 16.46 |
| fir rust | 0.15 | 3.97 | 4.98 | 7.15 | 11.04 |
| fir sse4.1 | 0.15 | 1.69 | 2.13 | 3.32 | 5.71 |
| fir avx2 | 0.15 | 1.73 | 1.94 | 2.30 | 4.33 |
| image | 25.53 | - | 56.37 | 84.03 | 111.89 |
| resize | 5.60 | 10.85 | 18.72 | 37.97 | 65.65 |
| libvips | 4.67 | 25.02 | 9.80 | 13.73 | 18.17 |
| fir rust | 0.15 | 4.94 | 6.37 | 8.97 | 13.36 |
| fir sse4.1 | 0.15 | 1.66 | 2.10 | 3.28 | 5.57 |
| fir avx2 | 0.15 | 1.76 | 1.96 | 2.37 | 4.41 |
<!-- bench_compare_l end -->
## Examples
+7 -5
View File
@@ -13,11 +13,13 @@ pub fn bench_color_mapper(bench_group: &mut utils::BenchGroup) {
src_image.pixel_type(),
);
let mapper = create_srgb_mapper();
bench_group.bench_function("SRGB U8x3 => RGB U8x3", |bencher| {
bencher.iter(|| {
mapper.forward_map(&src_image, &mut dst_image).unwrap();
})
});
bench_group
.criterion_group
.bench_function("SRGB U8x3 => RGB U8x3", |bencher| {
bencher.iter(|| {
mapper.forward_map(&src_image, &mut dst_image).unwrap();
})
});
}
fn main() {
+71 -8
View File
@@ -1,13 +1,24 @@
use std::env;
use std::path::PathBuf;
use std::time::SystemTime;
use std::time::{Duration, SystemTime};
use criterion::measurement::WallTime;
use criterion::{Bencher, BenchmarkGroup, BenchmarkId, Criterion};
use super::{cargo_target_directory, get_arch_id_and_name, get_results, BenchResult};
pub type BenchGroup<'a> = BenchmarkGroup<'a, WallTime>;
pub struct BenchGroup<'a> {
pub criterion_group: BenchmarkGroup<'a, WallTime>,
old_results: Vec<BenchResult>,
results: Vec<BenchResult>,
}
impl<'a> BenchGroup<'a> {
fn finish(self) -> Vec<BenchResult> {
self.criterion_group.finish();
self.results
}
}
pub fn run_bench<F>(bench_fn: F, name: &str) -> Vec<BenchResult>
where
@@ -22,14 +33,43 @@ where
.configure_from_args();
let now = SystemTime::now();
let results_dir = output_dir.join(name);
let mut group = criterion.benchmark_group(name);
let results_lifetime: u32 = env::var("RESULTS_LIFETIME")
.unwrap_or_else(|_| "0".to_owned())
.parse()
.unwrap_or_default();
let old_results = if results_lifetime > 0 && name.starts_with("Compare ") {
let old_now = now - Duration::from_secs(results_lifetime as u64 * 24 * 3600);
get_results(&results_dir, &old_now)
} else {
vec![]
};
let mut group = BenchGroup {
criterion_group: criterion.benchmark_group(name),
old_results,
results: vec![],
};
bench_fn(&mut group);
group.finish();
let mut results = group.finish();
criterion.final_summary();
let results_dir = output_dir.join(name);
get_results(&results_dir, &now)
let new_results = get_results(&results_dir, &now);
if new_results.is_empty() {
new_results
} else {
for res in results.iter_mut().filter(|r| r.estimate < 0.) {
res.estimate = new_results
.iter()
.find(|new_res| {
new_res.function_name == res.function_name && new_res.parameter == res.parameter
})
.map(|r| r.estimate)
.unwrap_or(0.)
}
results
}
}
pub fn bench<S1, S2, F>(
@@ -44,8 +84,31 @@ pub fn bench<S1, S2, F>(
F: FnMut(&mut Bencher),
{
let parameter = parameter.into();
group.sample_size(sample_size);
group.bench_with_input(
let func_name = func_name.into();
// Use old results only for other libraries, not for 'fast_image_resize'
if !func_name.starts_with("fir ") {
if let Some(old_res) = group
.old_results
.iter()
.find(|res| res.function_name == func_name && res.parameter == parameter)
{
group.results.push(old_res.clone());
println!(
"SKIP benching of '{}' function with '{}' parameter due to using old result.",
func_name, parameter
);
return;
}
}
group.results.push(BenchResult {
function_name: func_name.clone(),
parameter: parameter.clone(),
estimate: -1., // Unknown result
});
group.criterion_group.sample_size(sample_size);
group.criterion_group.bench_with_input(
BenchmarkId::new(func_name, &parameter),
&parameter,
|bencher, _| f(bencher),
+1 -1
View File
@@ -10,7 +10,7 @@ use walkdir::WalkDir;
use super::get_arch_id_and_name;
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct BenchResult {
pub function_name: String,
pub parameter: String,
+34 -34
View File
@@ -39,11 +39,11 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:------:|:--------:|:-------:|:--------:|
| image | 90.69 | - | 168.18 | 299.23 | 427.40 |
| resize | 18.16 | 58.87 | 101.28 | 188.75 | 277.33 |
| libvips | 27.10 | 128.31 | 106.99 | 210.32 | 284.40 |
| fir rust | 0.90 | 29.31 | 44.65 | 107.87 | 142.49 |
| fir neon | 0.90 | 19.68 | 29.98 | 50.44 | 74.62 |
| image | 81.35 | - | 155.47 | 292.99 | 420.30 |
| resize | 17.88 | 58.72 | 99.72 | 191.53 | 283.22 |
| libvips | 26.19 | 127.94 | 108.26 | 211.62 | 281.96 |
| fir rust | 0.90 | 25.61 | 40.74 | 105.03 | 140.08 |
| fir neon | 0.90 | 19.74 | 29.20 | 49.33 | 73.89 |
<!-- bench_compare_rgb end -->
@@ -62,10 +62,10 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:------:|:--------:|:-------:|:--------:|
| resize | 24.31 | 85.76 | 124.73 | 213.75 | 308.93 |
| libvips | 35.14 | 239.46 | 356.80 | 703.89 | 947.88 |
| fir rust | 0.96 | 53.44 | 69.96 | 157.47 | 205.40 |
| fir neon | 0.96 | 37.38 | 51.67 | 79.36 | 108.03 |
| resize | 24.78 | 87.91 | 123.06 | 214.90 | 304.80 |
| libvips | 35.85 | 237.77 | 359.87 | 708.06 | 956.23 |
| fir rust | 0.94 | 49.35 | 66.77 | 154.14 | 202.65 |
| fir neon | 0.94 | 36.60 | 50.20 | 76.66 | 106.89 |
<!-- bench_compare_rgba end -->
@@ -83,11 +83,11 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 81.40 | - | 106.89 | 178.47 | 248.19 |
| resize | 10.70 | 28.04 | 39.95 | 70.96 | 95.71 |
| libvips | 12.34 | 50.17 | 39.13 | 70.50 | 96.28 |
| fir rust | 0.47 | 11.48 | 15.68 | 24.28 | 35.24 |
| fir neon | 0.47 | 6.09 | 9.34 | 16.20 | 24.99 |
| image | 77.04 | - | 106.26 | 173.16 | 243.71 |
| resize | 11.02 | 29.25 | 41.11 | 67.09 | 96.79 |
| libvips | 12.02 | 49.78 | 39.45 | 72.24 | 95.72 |
| fir rust | 0.50 | 10.14 | 14.42 | 34.24 | 45.02 |
| fir neon | 0.50 | 6.14 | 9.33 | 16.24 | 24.50 |
<!-- bench_compare_l end -->
@@ -108,9 +108,9 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:------:|:--------:|:-------:|:--------:|
| libvips | 19.70 | 146.65 | 228.38 | 402.65 | 555.39 |
| fir rust | 0.66 | 41.60 | 51.73 | 92.90 | 106.33 |
| fir neon | 0.66 | 18.86 | 25.14 | 37.43 | 52.43 |
| libvips | 19.49 | 147.59 | 223.85 | 401.32 | 549.79 |
| fir rust | 0.67 | 25.55 | 36.12 | 66.30 | 74.14 |
| fir neon | 0.67 | 18.32 | 24.74 | 37.13 | 53.14 |
<!-- bench_compare_la end -->
@@ -128,11 +128,11 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:------:|:--------:|:-------:|:--------:|
| image | 94.20 | - | 170.28 | 338.10 | 487.16 |
| resize | 19.54 | 57.93 | 97.88 | 186.57 | 274.03 |
| libvips | 27.45 | 141.20 | 116.02 | 241.02 | 312.91 |
| fir rust | 1.37 | 61.30 | 91.44 | 149.30 | 188.70 |
| fir neon | 1.37 | 61.06 | 70.69 | 93.07 | 134.12 |
| image | 82.63 | - | 156.54 | 313.14 | 458.26 |
| resize | 19.42 | 58.83 | 98.96 | 187.79 | 273.43 |
| libvips | 27.75 | 142.96 | 116.71 | 240.22 | 310.89 |
| fir rust | 1.46 | 56.42 | 78.80 | 138.76 | 180.98 |
| fir neon | 1.46 | 62.65 | 72.34 | 95.01 | 134.46 |
<!-- bench_compare_rgb16 end -->
@@ -151,10 +151,10 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:------:|:--------:|:-------:|:--------:|
| resize | 28.13 | 89.26 | 130.60 | 226.11 | 321.18 |
| libvips | 36.84 | 247.88 | 377.52 | 730.92 | 997.26 |
| fir rust | 1.53 | 105.18 | 137.04 | 226.61 | 286.05 |
| fir neon | 1.53 | 55.58 | 78.28 | 119.44 | 164.93 |
| resize | 28.30 | 92.30 | 133.03 | 231.50 | 331.17 |
| libvips | 37.22 | 244.27 | 374.70 | 734.02 | 1002.61 |
| fir rust | 1.54 | 102.16 | 136.90 | 226.23 | 287.39 |
| fir neon | 1.54 | 56.83 | 79.00 | 120.50 | 166.11 |
<!-- bench_compare_rgba16 end -->
@@ -172,11 +172,11 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 83.21 | - | 114.62 | 190.60 | 264.48 |
| resize | 11.44 | 28.56 | 44.56 | 77.73 | 101.13 |
| libvips | 12.35 | 55.45 | 42.78 | 80.09 | 104.97 |
| fir rust | 0.66 | 27.61 | 37.81 | 56.81 | 79.79 |
| fir neon | 0.66 | 13.18 | 17.72 | 27.13 | 38.72 |
| image | 77.69 | - | 107.96 | 183.76 | 257.47 |
| resize | 11.67 | 28.88 | 47.17 | 76.66 | 103.51 |
| libvips | 12.48 | 55.66 | 41.58 | 82.70 | 106.61 |
| fir rust | 0.66 | 26.14 | 36.65 | 55.52 | 76.01 |
| fir neon | 0.66 | 13.37 | 17.58 | 27.39 | 39.01 |
<!-- bench_compare_l16 end -->
@@ -197,8 +197,8 @@ Pipeline:
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|----------|:-------:|:------:|:--------:|:-------:|:--------:|
| libvips | 21.02 | 153.62 | 246.05 | 435.33 | 585.66 |
| fir rust | 0.93 | 58.74 | 72.66 | 110.12 | 145.87 |
| fir neon | 0.93 | 27.97 | 37.06 | 55.73 | 75.52 |
| libvips | 20.62 | 152.38 | 238.83 | 433.39 | 584.20 |
| fir rust | 0.95 | 43.78 | 60.65 | 95.25 | 132.69 |
| fir neon | 0.95 | 27.28 | 36.73 | 55.64 | 76.28 |
<!-- bench_compare_la16 end -->
+59 -43
View File
@@ -1,22 +1,21 @@
<!-- introduction start -->
## Benchmarks of fast_image_resize crate for Wasm32 architecture
Environment:
- CPU: AMD Ryzen 9 5950X
- RAM: DDR4 3800 MHz
- Ubuntu 22.04 (linux 6.2.0)
- Rust 1.75.0
- RAM: DDR4 4000 MHz
- Ubuntu 22.04 (linux 6.5.0)
- Rust 1.78
- criterion = "0.5.1"
- fast_image_resize = "3.0.0"
- wasmtime = "16.0.0"
- fast_image_resize = "4.0.0"
- wasmtime = "20.0.0"
Other libraries used to compare of resizing speed:
- image = "0.24.7" (<https://crates.io/crates/image>)
- resize = "0.8.3" (<https://crates.io/crates/resize>)
- image = "0.25.1" (<https://crates.io/crates/image>)
- resize = "0.8.4" (<https://crates.io/crates/resize>)
Resize algorithms:
@@ -25,9 +24,11 @@ Resize algorithms:
- Bilinear - convolution with minimal kernel size 2x2 px
- Bicubic (CatmullRom) - convolution with minimal kernel size 4x4 px
- Lanczos3 - convolution with minimal kernel size 6x6 px
<!-- introduction end -->
<!-- bench_compare_rgb start -->
### Resize RGB8 image (U8x3) 4928x3279 => 852x567
Pipeline:
@@ -35,17 +36,19 @@ Pipeline:
`src_image => resize => dst_image`
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 19.06 | - | 99.24 | 180.42 | 264.28 |
| resize | - | 33.91 | 60.04 | 114.44 | 167.43 |
| fir rust | 0.38 | 45.67 | 81.65 | 155.12 | 228.96 |
| fir simd128 | 0.38 | 5.34 | 7.07 | 12.27 | 18.58 |
| image | 17.34 | - | 101.44 | 186.62 | 270.94 |
| resize | 10.98 | 33.34 | 61.39 | 116.05 | 182.75 |
| fir rust | 0.38 | 44.44 | 77.71 | 145.67 | 213.76 |
| fir simd128 | 0.38 | 6.22 | 8.33 | 13.44 | 20.59 |
<!-- bench_compare_rgb end -->
<!-- bench_compare_rgba start -->
### Resize RGBA8 image (U8x4) 4928x3279 => 852x567
Pipeline:
@@ -54,17 +57,19 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:------:|:--------:|:-------:|:--------:|
| resize | - | 40.06 | 73.00 | 138.37 | 203.32 |
| fir rust | 0.25 | 100.39 | 146.20 | 239.29 | 332.48 |
| fir simd128 | 0.25 | 12.04 | 14.62 | 21.49 | 29.35 |
| resize | 11.88 | 38.43 | 71.56 | 137.42 | 208.90 |
| fir rust | 0.26 | 108.03 | 161.33 | 272.43 | 384.54 |
| fir simd128 | 0.26 | 12.73 | 15.23 | 21.37 | 29.25 |
<!-- bench_compare_rgba end -->
<!-- bench_compare_l start -->
### Resize L8 image (U8) 4928x3279 => 852x567
Pipeline:
@@ -73,17 +78,19 @@ Pipeline:
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into grayscale image with one byte per pixel.
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 17.07 | - | 80.15 | 142.65 | 205.30 |
| resize | - | 18.11 | 28.94 | 52.80 | 76.84 |
| fir rust | 0.21 | 15.75 | 27.82 | 51.37 | 76.51 |
| fir simd128 | 0.21 | 2.56 | 3.00 | 4.51 | 7.31 |
| image | 16.36 | - | 79.55 | 142.10 | 203.30 |
| resize | 6.73 | 17.18 | 30.31 | 57.66 | 83.45 |
| fir rust | 0.21 | 16.02 | 27.48 | 50.59 | 74.72 |
| fir simd128 | 0.21 | 2.93 | 3.30 | 4.73 | 7.66 |
<!-- bench_compare_l end -->
<!-- bench_compare_la start -->
### Resize LA8 image (U8x2) 4928x3279 => 852x567
Pipeline:
@@ -93,17 +100,19 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
has converted into grayscale image with alpha channel (two bytes per pixel).
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
- The `resize` crate does not support this pixel format.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| fir rust | 0.19 | 52.58 | 80.84 | 137.68 | 198.83 |
| fir simd128 | 0.19 | 7.52 | 8.69 | 11.61 | 16.30 |
| fir rust | 0.20 | 51.14 | 75.07 | 123.35 | 171.89 |
| fir simd128 | 0.20 | 7.59 | 8.80 | 11.44 | 16.33 |
<!-- bench_compare_la end -->
<!-- bench_compare_rgb16 start -->
### Resize RGB16 image (U16x3) 4928x3279 => 852x567
Pipeline:
@@ -112,17 +121,19 @@ Pipeline:
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into RGB16 image.
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 19.11 | - | 96.10 | 173.83 | 252.76 |
| resize | - | 32.49 | 57.32 | 109.01 | 158.75 |
| fir rust | 0.43 | 40.56 | 62.58 | 109.75 | 155.99 |
| fir simd128 | 0.43 | 33.12 | 52.11 | 89.83 | 129.08 |
| image | 18.13 | - | 95.31 | 173.33 | 251.98 |
| resize | 11.03 | 30.34 | 55.99 | 107.76 | 152.73 |
| fir rust | 0.42 | 42.11 | 64.42 | 109.79 | 157.11 |
| fir simd128 | 0.42 | 32.56 | 51.45 | 89.52 | 129.08 |
<!-- bench_compare_rgb16 end -->
<!-- bench_compare_rgba16 start -->
### Resize RGBA16 image (U16x4) 4928x3279 => 852x567
Pipeline:
@@ -131,17 +142,19 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| resize | - | 40.13 | 74.22 | 140.36 | 207.29 |
| fir rust | 0.37 | 89.89 | 120.31 | 181.49 | 244.81 |
| fir simd128 | 0.37 | 53.75 | 77.43 | 124.93 | 173.79 |
| resize | 12.49 | 39.73 | 74.62 | 140.65 | 211.84 |
| fir rust | 0.41 | 94.07 | 126.42 | 190.18 | 256.18 |
| fir simd128 | 0.41 | 51.49 | 75.52 | 123.99 | 173.44 |
<!-- bench_compare_rgba16 end -->
<!-- bench_compare_l16 start -->
### Resize L16 image (U16) 4928x3279 => 852x567
Pipeline:
@@ -150,17 +163,19 @@ Pipeline:
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into grayscale image with two bytes per pixel.
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 17.48 | - | 80.39 | 142.73 | 205.56 |
| resize | - | 18.15 | 29.73 | 54.43 | 78.61 |
| fir rust | 0.19 | 19.81 | 29.13 | 47.86 | 66.83 |
| fir simd128 | 0.19 | 12.27 | 18.43 | 30.00 | 43.25 |
| image | 17.78 | - | 81.33 | 143.51 | 206.46 |
| resize | 8.06 | 18.72 | 29.77 | 54.94 | 79.38 |
| fir rust | 0.19 | 21.71 | 31.40 | 48.02 | 65.33 |
| fir simd128 | 0.19 | 12.15 | 18.24 | 30.03 | 43.44 |
<!-- bench_compare_l16 end -->
<!-- bench_compare_la16 start -->
### Resize LA16 (luma with alpha channel) image (U16x2) 4928x3279 => 852x567
Pipeline:
@@ -170,12 +185,13 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
has converted into grayscale image with alpha channel (four bytes per pixel).
- Numbers in table is mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
- The `resize` crate does not support this pixel format.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|-------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| fir rust | 0.23 | 50.38 | 68.90 | 106.26 | 143.58 |
| fir simd128 | 0.23 | 30.37 | 42.05 | 67.08 | 93.66 |
| fir rust | 0.25 | 49.12 | 64.81 | 94.16 | 123.91 |
| fir simd128 | 0.25 | 28.50 | 40.57 | 65.66 | 92.68 |
<!-- bench_compare_la16 end -->
+74 -58
View File
@@ -1,23 +1,22 @@
<!-- introduction start -->
## Benchmarks of fast_image_resize crate for x86_64 architecture
Environment:
- CPU: AMD Ryzen 9 5950X
- RAM: DDR4 3800 MHz
- Ubuntu 22.04 (linux 6.2.0)
- Rust 1.75.0
- RAM: DDR4 4000 MHz
- Ubuntu 22.04 (linux 6.5.0)
- Rust 1.78
- criterion = "0.5.1"
- fast_image_resize = "3.0.0"
- fast_image_resize = "4.0.0"
Other libraries used to compare of resizing speed:
- image = "0.24.7" (<https://crates.io/crates/image>)
- resize = "0.8.3" (<https://crates.io/crates/resize>)
- image = "0.25.1" (<https://crates.io/crates/image>)
- resize = "0.8.4" (<https://crates.io/crates/resize>)
- libvips = "8.12.1" (single-threaded mode, cache disabled)
Resize algorithms:
- Nearest
@@ -25,9 +24,11 @@ Resize algorithms:
- Bilinear - convolution with minimal kernel size 2x2 px
- Bicubic (CatmullRom) - convolution with minimal kernel size 4x4 px
- Lanczos3 - convolution with minimal kernel size 6x6 px
<!-- introduction end -->
<!-- bench_compare_rgb start -->
### Resize RGB8 image (U8x3) 4928x3279 => 852x567
Pipeline:
@@ -35,19 +36,21 @@ Pipeline:
`src_image => resize => dst_image`
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 30.14 | - | 90.74 | 149.25 | 208.22 |
| resize | 7.78 | 26.82 | 53.54 | 97.38 | 144.44 |
| libvips | 7.78 | 59.56 | 18.69 | 30.36 | 39.69 |
| fir rust | 0.28 | 9.17 | 14.72 | 26.24 | 38.98 |
| fir sse4.1 | 0.28 | 4.08 | 5.79 | 10.32 | 15.94 |
| fir avx2 | 0.28 | 3.01 | 3.86 | 6.89 | 12.69 |
| image | 28.28 | - | 82.31 | 134.61 | 186.22 |
| resize | 7.83 | 26.85 | 53.70 | 97.59 | 144.79 |
| libvips | 7.76 | 59.65 | 19.83 | 30.73 | 39.80 |
| fir rust | 0.28 | 12.77 | 17.94 | 27.94 | 40.05 |
| fir sse4.1 | 0.28 | 3.99 | 5.66 | 9.86 | 15.42 |
| fir avx2 | 0.28 | 3.06 | 3.89 | 6.85 | 13.25 |
<!-- bench_compare_rgb end -->
<!-- bench_compare_rgba start -->
### Resize RGBA8 image (U8x4) 4928x3279 => 852x567
Pipeline:
@@ -56,19 +59,21 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:------:|:--------:|:-------:|:--------:|
| resize | 11.30 | 42.85 | 85.27 | 147.28 | 211.34 |
| libvips | 9.15 | 120.11 | 188.46 | 337.77 | 499.37 |
| fir rust | 0.20 | 20.69 | 27.88 | 41.83 | 56.67 |
| fir sse4.1 | 0.19 | 10.19 | 12.43 | 17.99 | 24.64 |
| fir avx2 | 0.20 | 7.55 | 8.77 | 13.45 | 20.62 |
| resize | 11.34 | 42.76 | 85.43 | 147.41 | 211.31 |
| libvips | 8.97 | 120.82 | 190.82 | 341.07 | 500.87 |
| fir rust | 0.19 | 21.79 | 28.34 | 42.24 | 56.72 |
| fir sse4.1 | 0.19 | 10.14 | 12.26 | 18.43 | 24.22 |
| fir avx2 | 0.19 | 7.44 | 8.48 | 14.10 | 21.31 |
<!-- bench_compare_rgba end -->
<!-- bench_compare_l start -->
### Resize L8 image (U8) 4928x3279 => 852x567
Pipeline:
@@ -77,19 +82,21 @@ Pipeline:
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into grayscale image with one byte per pixel.
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 27.05 | - | 58.63 | 86.87 | 115.57 |
| resize | 6.44 | 11.49 | 21.83 | 43.93 | 71.01 |
| libvips | 4.69 | 25.00 | 9.69 | 12.95 | 16.46 |
| fir rust | 0.15 | 3.97 | 4.98 | 7.15 | 11.04 |
| fir sse4.1 | 0.15 | 1.69 | 2.13 | 3.32 | 5.71 |
| fir avx2 | 0.15 | 1.73 | 1.94 | 2.30 | 4.33 |
| image | 25.53 | - | 56.37 | 84.03 | 111.89 |
| resize | 5.60 | 10.85 | 18.72 | 37.97 | 65.65 |
| libvips | 4.67 | 25.02 | 9.80 | 13.73 | 18.17 |
| fir rust | 0.15 | 4.94 | 6.37 | 8.97 | 13.36 |
| fir sse4.1 | 0.15 | 1.66 | 2.10 | 3.28 | 5.57 |
| fir avx2 | 0.15 | 1.76 | 1.96 | 2.37 | 4.41 |
<!-- bench_compare_l end -->
<!-- bench_compare_la start -->
### Resize LA8 image (U8x2) 4928x3279 => 852x567
Pipeline:
@@ -99,19 +106,21 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
has converted into grayscale image with alpha channel (two bytes per pixel).
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
- The `resize` crate does not support this pixel format.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| libvips | 6.54 | 73.82 | 118.25 | 206.24 | 293.99 |
| fir rust | 0.18 | 10.95 | 12.78 | 17.17 | 23.78 |
| fir sse4.1 | 0.17 | 6.21 | 7.31 | 9.73 | 14.07 |
| fir avx2 | 0.17 | 4.23 | 4.72 | 6.26 | 8.87 |
| libvips | 6.45 | 73.39 | 117.87 | 205.86 | 293.32 |
| fir rust | 0.17 | 16.83 | 18.97 | 24.14 | 31.45 |
| fir sse4.1 | 0.17 | 6.15 | 7.17 | 9.64 | 13.40 |
| fir avx2 | 0.17 | 4.30 | 4.89 | 6.50 | 9.73 |
<!-- bench_compare_la end -->
<!-- bench_compare_rgb16 start -->
### Resize RGB16 image (U16x3) 4928x3279 => 852x567
Pipeline:
@@ -120,19 +129,21 @@ Pipeline:
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into RGB16 image.
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 30.85 | - | 84.62 | 136.64 | 190.22 |
| resize | 8.09 | 26.36 | 50.24 | 96.74 | 143.86 |
| libvips | 16.01 | 62.96 | 54.26 | 102.92 | 125.23 |
| fir rust | 0.34 | 25.73 | 39.52 | 67.32 | 96.71 |
| fir sse4.1 | 0.36 | 16.25 | 23.15 | 36.67 | 51.82 |
| fir avx2 | 0.34 | 14.02 | 19.32 | 30.01 | 37.16 |
| image | 28.09 | - | 82.63 | 134.66 | 185.48 |
| resize | 8.06 | 26.77 | 51.13 | 97.40 | 144.26 |
| libvips | 16.00 | 63.19 | 54.32 | 103.03 | 125.58 |
| fir rust | 0.33 | 27.24 | 42.15 | 72.69 | 104.45 |
| fir sse4.1 | 0.33 | 15.98 | 23.43 | 38.31 | 54.65 |
| fir avx2 | 0.33 | 13.90 | 19.49 | 29.92 | 36.67 |
<!-- bench_compare_rgb16 end -->
<!-- bench_compare_rgba16 start -->
### Resize RGBA16 image (U16x4) 4928x3279 => 852x567
Pipeline:
@@ -141,19 +152,21 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:------:|:--------:|:-------:|:--------:|
| resize | 11.89 | 43.39 | 83.74 | 144.33 | 206.71 |
| libvips | 22.60 | 129.23 | 205.57 | 367.46 | 538.41 |
| fir rust | 0.37 | 58.67 | 77.53 | 114.73 | 153.99 |
| fir sse4.1 | 0.38 | 31.85 | 42.51 | 63.89 | 86.03 |
| fir avx2 | 0.39 | 20.00 | 25.44 | 36.04 | 47.38 |
| resize | 12.17 | 42.81 | 83.83 | 144.13 | 206.21 |
| libvips | 22.58 | 130.14 | 209.14 | 367.87 | 536.49 |
| fir rust | 0.37 | 59.65 | 78.35 | 116.41 | 155.49 |
| fir sse4.1 | 0.37 | 31.77 | 42.27 | 63.73 | 85.90 |
| fir avx2 | 0.37 | 20.39 | 26.03 | 36.49 | 47.81 |
<!-- bench_compare_rgba16 end -->
<!-- bench_compare_l16 start -->
### Resize L16 image (U16) 4928x3279 => 852x567
Pipeline:
@@ -162,19 +175,21 @@ Pipeline:
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into grayscale image with two bytes per pixel.
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| image | 27.48 | - | 59.32 | 88.21 | 117.58 |
| resize | 6.29 | 11.31 | 20.55 | 44.20 | 68.86 |
| libvips | 7.89 | 26.35 | 20.67 | 36.39 | 46.13 |
| fir rust | 0.17 | 13.64 | 19.76 | 28.76 | 39.82 |
| fir sse4.1 | 0.17 | 5.34 | 7.53 | 12.93 | 18.85 |
| fir avx2 | 0.17 | 5.45 | 6.35 | 8.45 | 13.52 |
| image | 25.68 | - | 56.85 | 85.61 | 114.66 |
| resize | 6.30 | 9.95 | 16.04 | 33.38 | 58.32 |
| libvips | 7.42 | 26.00 | 21.69 | 36.26 | 46.04 |
| fir rust | 0.17 | 13.56 | 19.27 | 28.71 | 40.87 |
| fir sse4.1 | 0.17 | 5.26 | 7.44 | 12.86 | 18.78 |
| fir avx2 | 0.17 | 5.44 | 6.42 | 8.56 | 13.65 |
<!-- bench_compare_l16 end -->
<!-- bench_compare_la16 start -->
### Resize LA16 (luma with alpha channel) image (U16x2) 4928x3279 => 852x567
Pipeline:
@@ -184,14 +199,15 @@ Pipeline:
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
has converted into grayscale image with alpha channel (four bytes per pixel).
- Numbers in table are mean duration of image resizing in milliseconds.
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
- The `resize` crate does not support this pixel format.
| | Nearest | Box | Bilinear | Bicubic | Lanczos3 |
|------------|:-------:|:-----:|:--------:|:-------:|:--------:|
| libvips | 12.50 | 79.75 | 133.81 | 232.26 | 329.04 |
| fir rust | 0.20 | 25.00 | 32.91 | 51.64 | 71.49 |
| fir sse4.1 | 0.20 | 15.02 | 21.36 | 34.09 | 46.03 |
| fir avx2 | 0.20 | 11.62 | 14.91 | 21.95 | 29.14 |
| libvips | 12.53 | 80.02 | 134.11 | 231.61 | 328.41 |
| fir rust | 0.19 | 25.16 | 32.76 | 51.72 | 70.89 |
| fir sse4.1 | 0.19 | 14.92 | 21.27 | 33.49 | 45.88 |
| fir avx2 | 0.19 | 11.72 | 15.02 | 21.87 | 29.07 |
<!-- bench_compare_la16 end -->
+7
View File
@@ -33,6 +33,13 @@ report files, such as `./benchmarks-x86_64.md`:
WRITE_COMPARE_RESULT=1 cargo bench -- Compare
```
If you want to use old benchmark results for other crates, you must add
env variable with number of days as a result lifetime:
```shell
WRITE_COMPARE_RESULT=1 RESULTS_LIFETIME=5 cargo bench -- Compare
```
# Wasm32
Specify build target in `.cargo/config.toml` file.