Skip to content

Commit 93f9023

Browse files
authored
Add hyperfine installation instructions; update hyperfine code samples (#13034)
## Summary When following the step-by-step instructions to run the benchmarks in `CONTRIBUTING.md`, I encountered two errors: **Error 1:** `bash: hyperfine: command not found` **Solution**: I updated the instructions to include the step of installing the benchmark tool. **Error 2:** ```shell $ ./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ error: `ruff <path>` has been removed. Use `ruff check <path>` instead. ``` **Solution**: I added `check`. ## Test Plan I tested it by running the benchmark-related commands in a new workspace within GitHub Codespaces.
1 parent 8144a11 commit 93f9023

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

CONTRIBUTING.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,18 @@ which makes it a good target for benchmarking.
397397
git clone --branch 3.10 https://github.com/python/cpython.git crates/ruff_linter/resources/test/cpython
398398
```
399399

400+
Install `hyperfine`:
401+
402+
```shell
403+
cargo install hyperfine
404+
```
405+
400406
To benchmark the release build:
401407

402408
```shell
403409
cargo build --release && hyperfine --warmup 10 \
404-
"./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache -e" \
405-
"./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ -e"
410+
"./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ --no-cache -e" \
411+
"./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ -e"
406412
407413
Benchmark 1: ./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache
408414
Time (mean ± σ): 293.8 ms ± 3.2 ms [User: 2384.6 ms, System: 90.3 ms]
@@ -421,7 +427,7 @@ To benchmark against the ecosystem's existing tools:
421427
422428
```shell
423429
hyperfine --ignore-failure --warmup 5 \
424-
"./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache" \
430+
"./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ --no-cache" \
425431
"pyflakes crates/ruff_linter/resources/test/cpython" \
426432
"autoflake --recursive --expand-star-imports --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys resources/test/cpython" \
427433
"pycodestyle crates/ruff_linter/resources/test/cpython" \
@@ -467,7 +473,7 @@ To benchmark a subset of rules, e.g. `LineTooLong` and `DocLineTooLong`:
467473
468474
```shell
469475
cargo build --release && hyperfine --warmup 10 \
470-
"./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache -e --select W505,E501"
476+
"./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ --no-cache -e --select W505,E501"
471477
```
472478
473479
You can run `poetry install` from `./scripts/benchmarks` to create a working environment for the

0 commit comments

Comments
 (0)