From 01daf2671760e8b27af8a88a70524e02a6354665 Mon Sep 17 00:00:00 2001 From: olp-cs <162949+olp-cs@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:16:32 +0000 Subject: [PATCH 1/3] Add `hyperfine` installation instructions to docs and .devcontainer --- .devcontainer/post-create.sh | 1 + CONTRIBUTING.md | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 0a81beacfdb6a..66a12d2377efa 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -3,6 +3,7 @@ rustup default < rust-toolchain rustup component add clippy rustfmt cargo install cargo-insta +cargo install hyperfine cargo fetch pip install maturin pre-commit diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b89d83325425a..362815de9360a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -397,6 +397,12 @@ which makes it a good target for benchmarking. git clone --branch 3.10 https://github.com/python/cpython.git crates/ruff_linter/resources/test/cpython ``` +Install `hyperfine`: + +```shell +cargo install hyperfine +``` + To benchmark the release build: ```shell From c2f0d1f02f4398802c0ebf514f7f937a442e1101 Mon Sep 17 00:00:00 2001 From: olp-cs <162949+olp-cs@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:44:08 +0000 Subject: [PATCH 2/3] Fix the error: `ruff ` has been removed. Use `ruff check ` instead. --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 362815de9360a..6aa5646a6f45a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -407,8 +407,8 @@ To benchmark the release build: ```shell cargo build --release && hyperfine --warmup 10 \ - "./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache -e" \ - "./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ -e" + "./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ --no-cache -e" \ + "./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ -e" Benchmark 1: ./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache Time (mean ± σ): 293.8 ms ± 3.2 ms [User: 2384.6 ms, System: 90.3 ms] @@ -427,7 +427,7 @@ To benchmark against the ecosystem's existing tools: ```shell hyperfine --ignore-failure --warmup 5 \ - "./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache" \ + "./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ --no-cache" \ "pyflakes crates/ruff_linter/resources/test/cpython" \ "autoflake --recursive --expand-star-imports --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys resources/test/cpython" \ "pycodestyle crates/ruff_linter/resources/test/cpython" \ @@ -473,7 +473,7 @@ To benchmark a subset of rules, e.g. `LineTooLong` and `DocLineTooLong`: ```shell cargo build --release && hyperfine --warmup 10 \ - "./target/release/ruff ./crates/ruff_linter/resources/test/cpython/ --no-cache -e --select W505,E501" + "./target/release/ruff check ./crates/ruff_linter/resources/test/cpython/ --no-cache -e --select W505,E501" ``` You can run `poetry install` from `./scripts/benchmarks` to create a working environment for the From 5af19ba51523581bd741fa3408a21177eb9b95d3 Mon Sep 17 00:00:00 2001 From: olp-cs <162949+olp-cs@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:13:36 +0000 Subject: [PATCH 3/3] Revert changes to `.devcontainer/post-create.sh` --- .devcontainer/post-create.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 66a12d2377efa..0a81beacfdb6a 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -3,7 +3,6 @@ rustup default < rust-toolchain rustup component add clippy rustfmt cargo install cargo-insta -cargo install hyperfine cargo fetch pip install maturin pre-commit