Skip to content

Commit 0ddf8a9

Browse files
.
1 parent a9eadc4 commit 0ddf8a9

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

pyrefly/lib/test/lsp/lsp_interaction/code_action_benchmark.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,16 @@ fn print_stats(label: &str, samples: &[Duration]) {
6666
let mut sorted = samples.to_vec();
6767
sorted.sort();
6868
let count = sorted.len() as u64;
69-
let total: Duration = sorted.iter().copied().fold(Duration::ZERO, |acc, v| acc + v);
69+
let total: Duration = sorted
70+
.iter()
71+
.copied()
72+
.fold(Duration::ZERO, |acc, v| acc + v);
7073
let mean_nanos = total.as_nanos() / count as u128;
7174
let mean = Duration::from_nanos(mean_nanos as u64);
7275
let p50 = sorted[sorted.len() / 2];
73-
let p95 =
74-
sorted[(((sorted.len() as f64) * 0.95).floor() as usize).min(sorted.len() - 1)];
75-
let p99 =
76-
sorted[(((sorted.len() as f64) * 0.99).floor() as usize).min(sorted.len() - 1)];
77-
eprintln!(
78-
"{label}: count={count} mean={mean:?} p50={p50:?} p95={p95:?} p99={p99:?}"
79-
);
76+
let p95 = sorted[(((sorted.len() as f64) * 0.95).floor() as usize).min(sorted.len() - 1)];
77+
let p99 = sorted[(((sorted.len() as f64) * 0.99).floor() as usize).min(sorted.len() - 1)];
78+
eprintln!("{label}: count={count} mean={mean:?} p50={p50:?} p95={p95:?} p99={p99:?}");
8079
}
8180

8281
#[test]

0 commit comments

Comments
 (0)