## Benchmarks of fast_image_resize crate for Wasm32 architecture
Environment:
- CPU: AMD Ryzen 9 5950X
- RAM: DDR4 4000 MHz
- Ubuntu 22.04 (linux 6.5.0)
- Rust 1.79
- criterion = "0.5.1"
- fast_image_resize = "4.1.0"
- wasmtime = "22.0.0"
Other libraries used to compare of resizing speed:
- image = "0.25.1" (<https://crates.io/crates/image>)
- resize = "0.8.4" (<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 | 26.19 | - | 103.03 | 180.66 | 258.39 |
| resize | 11.71 | 33.22 | 60.30 | 114.09 | 167.14 |
| fir rust | 0.39 | 45.14 | 79.53 | 150.42 | 223.19 |
| fir simd128 | 0.39 | 6.41 | 8.71 | 14.33 | 21.60 |
### 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 | 12.41 | 38.94 | 73.52 | 138.90 | 211.97 |
| fir rust | 0.27 | 101.41 | 147.99 | 244.04 | 341.24 |
| fir simd128 | 0.27 | 16.30 | 19.02 | 25.52 | 33.58 |
### 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 | 24.25 | - | 87.19 | 149.64 | 210.43 |
| resize | 7.87 | 17.80 | 28.64 | 53.29 | 77.57 |
| fir rust | 0.21 | 16.50 | 28.23 | 52.74 | 78.04 |
| fir simd128 | 0.21 | 3.02 | 3.32 | 4.66 | 7.59 |
### 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.20 | 50.44 | 73.54 | 120.60 | 168.31 |
| fir simd128 | 0.20 | 8.49 | 9.75 | 12.51 | 17.40 |
### 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 | 27.31 | - | 106.09 | 188.35 | 270.09 |
| resize | 12.10 | 33.83 | 60.20 | 113.85 | 168.18 |
| fir rust | 0.41 | 39.02 | 62.29 | 107.96 | 154.74 |
| fir simd128 | 0.41 | 32.47 | 51.34 | 89.26 | 129.12 |
### 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.69 | 39.35 | 74.01 | 139.45 | 213.46 |
| fir rust | 0.34 | 87.33 | 110.98 | 158.35 | 207.47 |
| fir simd128 | 0.34 | 51.84 | 75.53 | 123.10 | 172.10 |
### 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 | 23.98 | - | 86.94 | 149.67 | 211.09 |
| resize | 7.88 | 17.12 | 27.73 | 52.04 | 75.31 |
| fir rust | 0.19 | 21.90 | 30.69 | 49.16 | 69.15 |
| fir simd128 | 0.19 | 12.02 | 17.84 | 29.47 | 42.84 |
### 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.23 | 49.69 | 66.52 | 98.05 | 131.53 |
| fir simd128 | 0.23 | 28.41 | 40.62 | 65.56 | 92.21 |
### 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 | 12.99 | - | 56.03 | 101.33 | 145.65 |
| resize | 7.49 | 16.01 | 22.29 | 43.94 | 64.20 |
| fir rust | 0.24 | 11.16 | 19.88 | 39.47 | 60.69 |
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 | 32.63 | 44.56 | 70.31 | 97.25 |
### 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 | 16.21 | - | 66.86 | 121.43 | 176.37 |
| resize | 10.69 | 21.69 | 36.37 | 66.61 | 97.14 |
| fir rust | 1.05 | 31.15 | 52.73 | 96.40 | 143.25 |
### 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.27 | 55.23 | 78.01 | 126.18 | 175.73 |