Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update contributing docs to use cargo bench -p ruff_benchmark #9535

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,10 @@ if the benchmark improved/regressed compared to that baseline.

```shell
# Run once on your "baseline" code
cargo benchmark --save-baseline=main
cargo bench -p ruff_benchmark -- --save-baseline=main

# Then iterate with
cargo benchmark --baseline=main
cargo bench -p ruff_benchmark -- --baseline=main
```

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

```shell
# On main
cargo benchmark --save-baseline=main
cargo bench -p ruff_benchmark -- --save-baseline=main

# After applying your changes
cargo benchmark --save-baseline=pr
cargo bench -p ruff_benchmark -- --save-baseline=pr

critcmp main pr
```
Expand All @@ -547,10 +547,10 @@ cargo install critcmp

#### Tips

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

### Profiling Projects

Expand Down
13 changes: 12 additions & 1 deletion crates/ruff_benchmark/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Ruff Benchmarks

The `ruff_benchmark` crate benchmarks the linter and the formatter on individual files.
The `ruff_benchmark` crate benchmarks the linter and the formatter on individual files:

```shell
# Run once on the "baseline".
cargo bench -p ruff_benchmark -- --save-baseline=main

# Compare against the "baseline".
cargo bench -p ruff_benchmark -- --baseline=main

# Run the lexer benchmarks.
cargo bench -p ruff_benchmark lexer -- --baseline=main
```

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