Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 1.6 KB

dev.md

File metadata and controls

75 lines (52 loc) · 1.6 KB

Preparation

Install system libraries:

  • libvips-dev (used in benchmarks)

Install additional toolchains:

  • Arm64:
    rustup target add aarch64-unknown-linux-gnu
  • Wasm32:
    rustup target add wasm32-wasi
    Install Wasmtime.

Tests

Run tests with saving result images as files in ./data directory:

SAVE_RESULT=1 cargo test

Benchmarks

Run benchmarks to compare with other crates for image resizing and write results into 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:

WRITE_COMPARE_RESULT=1 RESULTS_LIFETIME=5 cargo bench -- Compare

Wasm32

Specify build target in .cargo/config.toml file.

[build]
target = "wasm32-wasi"

Run tests:

CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --" cargo test

Run tests with saving result images as files in ./data directory:

CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --env SAVE_RESULT=1 --" cargo test

Run a specific benchmark in quick mode:

CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --" 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:

CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime --dir=. --env WRITE_COMPARE_RESULT=1 --" cargo bench --no-fail-fast -- --color=always Compare