File: dev.md

package info (click to toggle)
rust-fast-image-resize 5.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,772 kB
  • sloc: makefile: 2
file content (75 lines) | stat: -rw-r--r-- 1,639 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Preparation

Install system libraries:

- libvips-dev (used in benchmarks)

Install additional toolchains:

- Arm64:
  ```shell
  rustup target add aarch64-unknown-linux-gnu
  ```
- Wasm32:
  ```shell
  rustup target add wasm32-wasi
  ```
  Install [Wasmtime](https://wasmtime.dev/).

# Tests

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

```shell
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`:

```shell
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.

```toml
[build]
target = "wasm32-wasi"
```

Run tests:

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

Run a specific benchmark in `quick` mode:

```shell
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`:

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