## Benchmarks of fast_image_resize crate for Wasm32 architecture
Environment:
- CPU: AMD Ryzen 9 5950X
- RAM: DDR4 4000 MHz
- Ubuntu 24.04 (linux 6.11.0)
- Rust 1.87.0
- criterion = "0.5.1"
- fast_image_resize = "5.1.4"
- wasmtime = "32.0.0"
Other libraries used to compare of resizing speed:
- image = "0.25.6" (<https://crates.io/crates/image>)
- resize = "0.8.8" (<https://crates.io/crates/resize>, single-threaded mode)
Resize algorithms:
- Nearest
- Box - convolution with minimal kernel size 1x1 px
- 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
### Resize RGB8 image (U8x3) 4928x3279 => 852x567
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 the table mean a duration of image resizing in milliseconds.
| image | 22.36 | - | 114.09 | 207.35 | 299.62 |
| resize | 11.40 | 32.71 | 59.71 | 113.30 | 167.48 |
| fir rust | 0.39 | 36.51 | 67.08 | 128.85 | 191.63 |
| fir simd128 | 0.39 | 4.82 | 7.46 | 13.43 | 19.83 |
### Resize RGBA8 image (U8x4) 4928x3279 => 852x567
Pipeline:
`src_image => multiply by alpha => resize => divide by alpha => dst_image`
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
| resize | 11.65 | 38.44 | 73.46 | 140.39 | 209.13 |
| fir rust | 0.25 | 89.18 | 129.75 | 211.68 | 294.66 |
| fir simd128 | 0.25 | 12.16 | 14.94 | 21.81 | 29.56 |
### Resize L8 image (U8) 4928x3279 => 852x567
Pipeline:
`src_image => resize => dst_image`
- 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 the table mean a duration of image resizing in milliseconds.
| image | 18.89 | - | 85.80 | 152.05 | 216.91 |
| resize | 6.67 | 16.13 | 27.43 | 50.73 | 74.16 |
| fir rust | 0.21 | 12.83 | 23.04 | 44.08 | 65.74 |
| fir simd128 | 0.21 | 2.66 | 3.43 | 5.53 | 8.26 |
### Resize LA8 image (U8x2) 4928x3279 => 852x567
Pipeline:
`src_image => multiply by alpha => resize => divide by alpha => dst_image`
- 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 an alpha channel (two bytes per pixel).
- 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.
| fir rust | 0.19 | 43.68 | 65.07 | 108.59 | 153.40 |
| fir simd128 | 0.19 | 7.04 | 8.48 | 11.78 | 16.11 |
### Resize RGB16 image (U16x3) 4928x3279 => 852x567
Pipeline:
`src_image => resize => dst_image`
- 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 the table mean a duration of image resizing in milliseconds.
| image | 21.29 | - | 103.21 | 186.77 | 269.27 |
| resize | 10.66 | 31.93 | 54.70 | 106.72 | 153.68 |
| fir rust | 0.41 | 31.09 | 52.53 | 97.53 | 142.71 |
| fir simd128 | 0.41 | 28.80 | 48.69 | 88.22 | 127.73 |
### Resize RGBA16 image (U16x4) 4928x3279 => 852x567
Pipeline:
`src_image => multiply by alpha => resize => divide by alpha => dst_image`
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- Numbers in the table mean a duration of image resizing in milliseconds.
- The `image` crate does not support multiplying and dividing by alpha channel.
| resize | 12.68 | 39.06 | 74.18 | 141.37 | 209.51 |
| fir rust | 0.42 | 84.14 | 117.31 | 178.55 | 243.12 |
| fir simd128 | 0.42 | 47.40 | 71.17 | 122.44 | 171.00 |
### Resize L16 image (U16) 4928x3279 => 852x567
Pipeline:
`src_image => resize => dst_image`
- 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 the table mean a duration of image resizing in milliseconds.
| image | 19.11 | - | 82.39 | 145.23 | 207.70 |
| resize | 7.85 | 18.17 | 29.70 | 53.69 | 78.64 |
| fir rust | 0.20 | 18.15 | 25.96 | 44.14 | 61.74 |
| fir simd128 | 0.20 | 10.18 | 17.22 | 29.79 | 42.83 |
### Resize LA16 (luma with alpha channel) image (U16x2) 4928x3279 => 852x567
Pipeline:
`src_image => multiply by alpha => resize => divide by alpha => dst_image`
- 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 an alpha channel (four bytes per pixel).
- 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.
| fir rust | 0.25 | 44.73 | 61.06 | 92.55 | 124.11 |
| fir simd128 | 0.25 | 24.57 | 37.51 | 63.99 | 90.32 |
### Resize L32F image (F32) 4928x3279 => 852x567
Pipeline:
`src_image => resize => dst_image`
- 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 the table mean a duration of image resizing in milliseconds.
| image | 11.33 | - | 58.92 | 106.75 | 155.04 |
| resize | 8.98 | 16.53 | 24.59 | 45.82 | 67.67 |
| fir rust | 0.25 | 10.13 | 18.35 | 36.05 | 60.08 |
Note:
The `resize` crate uses `f32` for intermediate calculations.
The `fast_image_resize` uses `f64`. This is a reason why `fast_image_resize`
is slower or equal in cases with `f32`-based pixels.
### Resize LA32F (luma with alpha channel) image (F32x2) 4928x3279 => 852x567
Pipeline:
`src_image => multiply by alpha => resize => divide by alpha => dst_image`
- 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 an alpha channel (two `f32` values per pixel).
- 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.
| fir rust | 0.42 | 30.89 | 43.06 | 70.18 | 101.63 |
### Resize RGB32F image (F32x3) 4928x3279 => 852x567
Pipeline:
`src_image => resize => dst_image`
- Source image [nasa-4928x3279.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279.png)
has converted into RGB32F image.
- Numbers in the table mean a duration of image resizing in milliseconds.
| image | 11.78 | - | 68.25 | 126.64 | 184.94 |
| resize | 10.76 | 21.80 | 34.28 | 64.89 | 96.11 |
| fir rust | 1.02 | 24.73 | 45.06 | 85.19 | 128.12 |
### Resize RGBA32F image (F32x4) 4928x3279 => 852x567
Pipeline:
`src_image => multiply by alpha => resize => divide by alpha => dst_image`
- Source image
[nasa-4928x3279-rgba.png](https://github.com/Cykooz/fast_image_resize/blob/main/data/nasa-4928x3279-rgba.png)
- 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 multiplying and dividing by alpha channel
for this pixel format.
| fir rust | 1.22 | 50.02 | 73.15 | 118.86 | 168.38 |