Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e7de9a8
Claude prototype for real world benchmarks
MichaReiser Jun 17, 2025
e62bf33
Add uv
MichaReiser Jun 17, 2025
6b0f777
Move to separate file, allow concurrent checking
MichaReiser Jun 17, 2025
7d58720
Add different projects
MichaReiser Jun 17, 2025
35d0e86
Use different projects
MichaReiser Jun 17, 2025
c2acebf
Add some logging
MichaReiser Jun 17, 2025
219d13f
Speedup git clone
MichaReiser Jun 17, 2025
a78c609
Add colour_science
MichaReiser Jun 17, 2025
7cdfea4
Use walltime runner
MichaReiser Jun 17, 2025
a669a2a
More projects
MichaReiser Jun 17, 2025
bf826ab
Reduce iterations for codspeed, disable multithreading
MichaReiser Jun 17, 2025
dac6ba0
Use --quick
MichaReiser Jun 17, 2025
7d13208
Try devan
MichaReiser Jun 17, 2025
78c9f4c
Prewarm rayon
MichaReiser Jun 17, 2025
463284f
Disable multithreading again
MichaReiser Jun 17, 2025
9012cb7
Unignore sympy
MichaReiser Jun 17, 2025
62040f0
Specify sample count instead of duration
MichaReiser Jun 17, 2025
a805bf0
Fix sample size
MichaReiser Jun 17, 2025
5c7950f
Update crates/ruff_benchmark/Cargo.toml
MichaReiser Jun 17, 2025
860d3b8
Update crates/ruff_benchmark/benches/ty.rs
MichaReiser Jun 17, 2025
53948d3
Apply suggestions from code review
MichaReiser Jun 17, 2025
d3ac9ba
Add altair
MichaReiser Jun 17, 2025
ece64c2
Enable multithreading
MichaReiser Jun 18, 2025
0cf0881
Split small/medium/lage benchmarks
MichaReiser Jun 18, 2025
1bf86f3
Remove unnecessary clone
MichaReiser Jun 18, 2025
7e82e5a
Disable multithreading once more, because it's slower over all
MichaReiser Jun 18, 2025
7327336
Pre-commit
MichaReiser Jun 18, 2025
5cee3f0
Code review feedback
MichaReiser Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ self-hosted-runner:
- depot-ubuntu-22.04-32
- github-windows-2025-x86_64-8
- github-windows-2025-x86_64-16
- codspeed-macro
38 changes: 36 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ jobs:
run: npm run fmt:check
working-directory: playground

benchmarks:
benchmarks-instrumented:
runs-on: ubuntu-24.04
needs: determine_changes
if: ${{ github.repository == 'astral-sh/ruff' && !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
Expand All @@ -905,6 +905,40 @@ jobs:
persist-credentials: false

- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0

- name: "Install Rust toolchain"
run: rustup show

- name: "Install codspeed"
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
with:
tool: cargo-codspeed

- name: "Build benchmarks"
run: cargo codspeed build --features "codspeed,instrumented" --no-default-features -p ruff_benchmark

- name: "Run benchmarks"
uses: CodSpeedHQ/action@0010eb0ca6e89b80c88e8edaaa07cfe5f3e6664d # v3.5.0
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}

benchmarks-walltime:
runs-on: codspeed-macro
needs: determine_changes
if: ${{ github.repository == 'astral-sh/ruff' && !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.ty == 'true' || github.ref == 'refs/heads/main') }}
timeout-minutes: 20
env:
TY_LOG: ruff_benchmark=debug
steps:
- name: "Checkout Branch"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
- uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0

- name: "Install Rust toolchain"
run: rustup show
Expand All @@ -915,7 +949,7 @@ jobs:
tool: cargo-codspeed

- name: "Build benchmarks"
run: cargo codspeed build --features codspeed -p ruff_benchmark
run: cargo codspeed build --features "codspeed,walltime" --no-default-features -p ruff_benchmark

- name: "Run benchmarks"
uses: CodSpeedHQ/action@0010eb0ca6e89b80c88e8edaaa07cfe5f3e6664d # v3.5.0
Expand Down
77 changes: 77 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ camino = { version = "1.1.7" }
clap = { version = "4.5.3", features = ["derive"] }
clap_complete_command = { version = "0.6.0" }
clearscreen = { version = "4.0.0" }
divan = { package = "codspeed-divan-compat", version = "2.10.1" }
codspeed-criterion-compat = { version = "2.6.0", default-features = false }
colored = { version = "3.0.0" }
console_error_panic_hook = { version = "0.1.7" }
Expand Down
46 changes: 36 additions & 10 deletions crates/ruff_benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,69 @@ doctest = false
[[bench]]
name = "linter"
harness = false
required-features = ["instrumented"]

[[bench]]
name = "lexer"
harness = false
required-features = ["instrumented"]

[[bench]]
name = "parser"
harness = false
required-features = ["instrumented"]

[[bench]]
name = "formatter"
harness = false
required-features = ["instrumented"]

[[bench]]
name = "ty"
harness = false
required-features = ["instrumented"]

[[bench]]
name = "ty_walltime"
harness = false
required-features = ["walltime"]

[dependencies]
ruff_db = { workspace = true, features = ["testing"] }
ruff_python_ast = { workspace = true }
ruff_linter = { workspace = true, optional = true }
ruff_python_formatter = { workspace = true, optional = true }
ruff_python_parser = { workspace = true, optional = true }
ruff_python_trivia = { workspace = true, optional = true }
ty_project = { workspace = true, optional = true }

divan = { workspace = true, optional = true }
anyhow = { workspace = true }
codspeed-criterion-compat = { workspace = true, default-features = false, optional = true }
criterion = { workspace = true, default-features = false }
criterion = { workspace = true, default-features = false, optional = true }
rayon = { workspace = true }
rustc-hash = { workspace = true }

[dev-dependencies]
ruff_db = { workspace = true }
ruff_linter = { workspace = true }
ruff_python_ast = { workspace = true }
ruff_python_formatter = { workspace = true }
ruff_python_parser = { workspace = true }
ruff_python_trivia = { workspace = true }
ty_project = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tracing = { workspace = true }

[lints]
workspace = true

[features]
default = ["instrumented", "walltime"]
# Enables the benchmark that should only run with codspeed's instrumented runner
instrumented = [
"criterion",
"ruff_linter",
"ruff_python_formatter",
"ruff_python_parser",
"ruff_python_trivia",
"ty_project",
]
codspeed = ["codspeed-criterion-compat"]
# Enables benchmark that should only run with codspeed's walltime runner.
walltime = ["ruff_db/os", "ty_project", "divan"]

[target.'cfg(target_os = "windows")'.dev-dependencies]
mimalloc = { workspace = true }
Expand Down
Loading
Loading