Skip to content

Commit cccbd02

Browse files
authored
[ty] Add Tanjun benchmark (#18850)
1 parent a6ad8fb commit cccbd02

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

crates/ruff_benchmark/benches/ty_walltime.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@ static SYMPY: std::sync::LazyLock<Benchmark<'static>> = std::sync::LazyLock::new
204204
)
205205
});
206206

207+
static TANJUN: std::sync::LazyLock<Benchmark<'static>> = std::sync::LazyLock::new(|| {
208+
Benchmark::new(
209+
RealWorldProject {
210+
name: "tanjun",
211+
repository: "https://github.com/FasterSpeeding/Tanjun",
212+
commit: "69f40db188196bc59516b6c69849c2d85fbc2f4a",
213+
paths: vec![SystemPath::new("tanjun")],
214+
dependencies: vec!["hikari", "alluka"],
215+
max_dep_date: "2025-06-17",
216+
python_version: PythonVersion::PY312,
217+
},
218+
100,
219+
)
220+
});
221+
207222
#[track_caller]
208223
fn run_single_threaded(bencher: Bencher, benchmark: &Benchmark) {
209224
bencher
@@ -213,7 +228,7 @@ fn run_single_threaded(bencher: Bencher, benchmark: &Benchmark) {
213228
});
214229
}
215230

216-
#[bench(args=[&*ALTAIR, &*FREQTRADE, &*PYDANTIC], sample_size=2, sample_count=3)]
231+
#[bench(args=[&*ALTAIR, &*FREQTRADE, &*PYDANTIC, &*TANJUN], sample_size=2, sample_count=3)]
217232
fn small(bencher: Bencher, benchmark: &Benchmark) {
218233
run_single_threaded(bencher, benchmark);
219234
}
@@ -254,5 +269,14 @@ fn main() {
254269

255270
let _logging = setup_logging_with_filter(&filter).expect("Filter to be valid");
256271

272+
// Salsa uses an optimized lookup for the ingredient index when using only a single database.
273+
// This optimization results in at least a 10% speedup compared to when using multiple databases.
274+
// To reduce noise, run one benchmark so that all benchmarks take the less optimized "not the first db"
275+
// branch when looking up the ingredient index.
276+
{
277+
let db = TANJUN.setup_iteration();
278+
check_project(&db, TANJUN.max_diagnostics);
279+
}
280+
257281
divan::main();
258282
}

0 commit comments

Comments
 (0)