Skip to content

Commit b983ab1

Browse files
Update contributing docs to use cargo bench -p ruff_benchmark (#9535)
## Summary I found that `cargo benchmark lexer` didn't work as expected: ```shell ❯ cargo benchmark lexer Finished bench [optimized] target(s) in 0.08s Running benches/formatter.rs (target/release/deps/formatter-4e1d9bf9d3ba529d) Running benches/linter.rs (target/release/deps/linter-e449086ddfd8ad8c) ``` Turns out that `cargo bench -p ruff_benchmark` is now recommended over `cargo benchmark`, so updating the docs to reflect that.
1 parent a1e65a9 commit b983ab1

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,10 @@ if the benchmark improved/regressed compared to that baseline.
518518

519519
```shell
520520
# Run once on your "baseline" code
521-
cargo benchmark --save-baseline=main
521+
cargo bench -p ruff_benchmark -- --save-baseline=main
522522
523523
# Then iterate with
524-
cargo benchmark --baseline=main
524+
cargo bench -p ruff_benchmark -- --baseline=main
525525
```
526526

527527
#### PR Summary
@@ -531,10 +531,10 @@ This is useful to illustrate the improvements of a PR.
531531

532532
```shell
533533
# On main
534-
cargo benchmark --save-baseline=main
534+
cargo bench -p ruff_benchmark -- --save-baseline=main
535535
536536
# After applying your changes
537-
cargo benchmark --save-baseline=pr
537+
cargo bench -p ruff_benchmark -- --save-baseline=pr
538538
539539
critcmp main pr
540540
```
@@ -547,10 +547,10 @@ cargo install critcmp
547547

548548
#### Tips
549549

550-
- Use `cargo benchmark <filter>` to only run specific benchmarks. For example: `cargo benchmark linter/pydantic`
551-
to only run the pydantic tests.
552-
- Use `cargo benchmark --quiet` for a more cleaned up output (without statistical relevance)
553-
- Use `cargo benchmark --quick` to get faster results (more prone to noise)
550+
- Use `cargo bench -p ruff_benchmark <filter>` to only run specific benchmarks. For example: `cargo benchmark lexer`
551+
to only run the lexer benchmarks.
552+
- Use `cargo bench -p ruff_benchmark -- --quiet` for a more cleaned up output (without statistical relevance)
553+
- Use `cargo bench -p ruff_benchmark -- --quick` to get faster results (more prone to noise)
554554

555555
### Profiling Projects
556556

crates/ruff_benchmark/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Ruff Benchmarks
22

3-
The `ruff_benchmark` crate benchmarks the linter and the formatter on individual files.
3+
The `ruff_benchmark` crate benchmarks the linter and the formatter on individual files:
4+
5+
```shell
6+
# Run once on the "baseline".
7+
cargo bench -p ruff_benchmark -- --save-baseline=main
8+
9+
# Compare against the "baseline".
10+
cargo bench -p ruff_benchmark -- --baseline=main
11+
12+
# Run the lexer benchmarks.
13+
cargo bench -p ruff_benchmark lexer -- --baseline=main
14+
```
415

516
See [CONTRIBUTING.md](../../CONTRIBUTING.md) on how to use these benchmarks.

0 commit comments

Comments
 (0)