Files
ruff/crates/ruff_benchmark/Cargo.toml
T
Lérè d155a44fed [ty] Run benchmarks for auto-imports in CI (#28490)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
- Does this PR follow our AI policy
(https://github.com/astral-sh/.github/blob/main/AI_POLICY.md)?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

This adds a few benchmarks for the language server's "auto-import"
feature to the set of benchmarks that we run in CI.

At present, we benchmark auto-imports for a regular package layout in
three Salsa database states: completely fresh (i.e. no cache), for an
identical, repeated request (i.e. fully-cached), and after a module
creation (i.e. partially-cached). This also includes setup for
benchmarking namespace packages, but those benchmarks remain disabled
until such support lands via
https://github.com/astral-sh/ty/issues/2273.

## Test Plan

You can see the results of the initial benchmarks runs
[below](https://github.com/astral-sh/ruff/pull/28490#issuecomment-5621409843).
<!-- How was it tested? -->
2026-09-11 11:47:43 -07:00

143 lines
3.9 KiB
TOML

[package]
name = "ruff_benchmark"
version = "0.0.0"
description = "Ruff Micro-benchmarks"
publish = false
authors = { workspace = true }
edition = { workspace = true }
rust-version = { workspace = true }
homepage = { workspace = true }
documentation = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
[lib]
bench = false
test = false
doctest = false
[dependencies]
ruff_db = { workspace = true, features = ["testing"] }
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_ide = { workspace = true, optional = true }
ty_module_resolver = { workspace = true, optional = true }
ty_project = { workspace = true, optional = true }
ty_python_semantic = { workspace = true, optional = true }
anyhow = { workspace = true }
codspeed-criterion-compat = { workspace = true, default-features = false, optional = true }
criterion = { workspace = true, default-features = false, optional = true }
divan = { workspace = true, optional = true }
serde = { workspace = true }
serde_json = { workspace = true }
tracing = { workspace = true }
[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64", target_arch = "riscv64")))'.dependencies]
tikv-jemallocator = { workspace = true, optional = true }
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = { workspace = true, optional = true }
[dev-dependencies]
rayon = { workspace = true }
ruff_python_ast = { workspace = true }
ruff_ranged_value = { workspace = true }
ruff_text_size = { workspace = true }
rustc-hash = { workspace = true }
tempfile = { workspace = true }
ty_static = { workspace = true }
[features]
default = ["module_resolution", "ruff_instrumented", "ty_ide", "ty_instrumented", "ty_walltime"]
# Enables the ruff instrumented benchmarks
ruff_instrumented = [
"criterion",
"ruff_linter",
"ruff_python_formatter",
"ruff_python_parser",
"ruff_python_trivia",
"mimalloc",
"tikv-jemallocator",
]
# Enables the ty instrumented benchmarks
ty_instrumented = ["criterion", "ty_project", "ty_python_semantic", "ruff_python_trivia"]
# Enables the module-resolution benchmark
module_resolution = ["divan", "ty_module_resolver", "ty_project"]
# Enables auto-import benchmarks.
ty_ide = ["divan", "dep:ty_ide", "ty_module_resolver", "ty_project", "ruff_db/os"]
codspeed = ["codspeed-criterion-compat"]
# Enables the ty_walltime benchmarks
ty_walltime = ["ruff_db/os", "ty_project", "divan"]
[[bench]]
name = "linter"
harness = false
required-features = ["ruff_instrumented"]
[[bench]]
name = "lexer"
harness = false
required-features = ["ruff_instrumented"]
[[bench]]
name = "parser"
harness = false
required-features = ["ruff_instrumented"]
[[bench]]
name = "formatter"
harness = false
required-features = ["ruff_instrumented"]
[[bench]]
name = "ty"
harness = false
required-features = ["ty_instrumented"]
[[bench]]
name = "ty_constraint_set"
harness = false
required-features = ["ty_instrumented"]
[[bench]]
name = "module_resolution"
harness = false
required-features = ["module_resolution"]
[[bench]]
name = "ty_script"
harness = false
required-features = ["ty_walltime"]
[[bench]]
name = "ty_ide"
harness = false
required-features = ["ty_ide"]
[[bench]]
name = "ty_walltime"
harness = false
required-features = ["ty_walltime"]
[lints]
workspace = true
[package.metadata.cargo-shear]
# We use optional dependencies even for dev dependencies for faster CI compile times.
# This is fine because this crate is "dev-only".
ignored = [
"divan",
"ruff_linter",
"ruff_python_formatter",
"ruff_python_parser",
"ruff_python_trivia",
"ty_ide",
"ty_module_resolver",
"ty_python_semantic",
"mimalloc",
"tikv-jemallocator"
]