mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:09:22 +00:00
Use named function in incremental red knot benchmark (#14033)
This commit is contained in:
parent
cf0f5e1318
commit
48fa839c80
1 changed files with 33 additions and 31 deletions
|
@ -120,13 +120,11 @@ fn setup_rayon() {
|
|||
}
|
||||
|
||||
fn benchmark_incremental(criterion: &mut Criterion) {
|
||||
setup_rayon();
|
||||
|
||||
criterion.bench_function("red_knot_check_file[incremental]", |b| {
|
||||
b.iter_batched_ref(
|
||||
|| {
|
||||
fn setup() -> Case {
|
||||
let case = setup_case();
|
||||
case.db.check().unwrap();
|
||||
let result = case.db.check().unwrap();
|
||||
|
||||
assert_eq!(result, EXPECTED_DIAGNOSTICS);
|
||||
|
||||
case.fs
|
||||
.write_file(
|
||||
|
@ -136,8 +134,9 @@ fn benchmark_incremental(criterion: &mut Criterion) {
|
|||
.unwrap();
|
||||
|
||||
case
|
||||
},
|
||||
|case| {
|
||||
}
|
||||
|
||||
fn incremental(case: &mut Case) {
|
||||
let Case { db, .. } = case;
|
||||
|
||||
db.apply_changes(
|
||||
|
@ -151,9 +150,12 @@ fn benchmark_incremental(criterion: &mut Criterion) {
|
|||
let result = db.check().unwrap();
|
||||
|
||||
assert_eq!(result, EXPECTED_DIAGNOSTICS);
|
||||
},
|
||||
BatchSize::SmallInput,
|
||||
);
|
||||
}
|
||||
|
||||
setup_rayon();
|
||||
|
||||
criterion.bench_function("red_knot_check_file[incremental]", |b| {
|
||||
b.iter_batched_ref(setup, incremental, BatchSize::SmallInput);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue