Updated dev-documentation part about Wasm32.

This commit is contained in:
Kirill Kuzminykh
2025-05-16 01:01:44 +03:00
parent f5f52cd57d
commit 969bb76073
2 changed files with 16 additions and 10 deletions
+4 -1
View File
@@ -2,7 +2,10 @@
### Fixed
- Fixed dividing image by alpha channel for images with `U16x2` pixels.
- Fixed `SSE4.1` and `AVX2` implementation fo dividing image by
alpha channel for images with `U16x2` pixels.
- Fixed `NEON` implementation for dividing image by
alpha channel for images with `U16x2` and `U16x4` pixels .
## [5.1.3] - 2025-04-06
+12 -9
View File
@@ -12,7 +12,7 @@ Install additional toolchains:
```
- Wasm32:
```shell
rustup target add wasm32-wasi
rustup target add wasm32-wasip2
```
Install [Wasmtime](https://wasmtime.dev/).
@@ -34,7 +34,7 @@ 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:
an env variable with the number of days as a result lifetime:
```shell
WRITE_COMPARE_RESULT=1 RESULTS_LIFETIME=5 cargo bench -- Compare
@@ -42,34 +42,37 @@ WRITE_COMPARE_RESULT=1 RESULTS_LIFETIME=5 cargo bench -- Compare
# Wasm32
Specify build target in `.cargo/config.toml` file.
Specify build target and runner in `.cargo/config.toml` file.
```toml
[build]
target = "wasm32-wasi"
target = "wasm32-wasip2"
[target.wasm32-wasip2]
runner = "wasmtime --dir=. --"
```
Run tests:
```shell
CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --" cargo test
cargo test
```
Run tests with saving result images as files in `./data` directory:
```shell
CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --env SAVE_RESULT=1 --" cargo test
CARGO_TARGET_WASM32_WASIP2_RUNNER="wasmtime --dir=. --env SAVE_RESULT=1 --" cargo test
```
Run a specific benchmark in `quick` mode:
```shell
CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --" cargo bench --bench bench_resize -- --color=always --quick
cargo bench --bench bench_resize -- --color=always --quick
```
Run benchmarks to compare with other crates for image resizing and write results into
report files, such as `./benchmarks-x86_64.md`:
report files, such as `./benchmarks-wasm32.md`:
```shell
CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --env WRITE_COMPARE_RESULT=1 --" cargo bench --no-fail-fast -- --color=always Compare
CARGO_TARGET_WASM32_WASIP2_RUNNER="wasmtime --dir=. --env WRITE_COMPARE_RESULT=1 --" cargo bench --no-fail-fast -- --color=always Compare
```