Files
orca/tests/tools/benchmarks/worktree-deletion-timing-samples.mjs
T
Neil 6bb2e13c35 refactor(tooling): organize remaining scripts by domain owners (#38407)
* refactor(tooling): group remaining scripts by concrete domain owners

* fix(tooling): preserve relocated launcher resource roots
2026-11-05 00:29:16 -08:00

22 lines
563 B
JavaScript

export function summarize(values) {
const samples = values.map((value) => round(value)).sort((a, b) => a - b)
if (samples.length === 0) {
return { count: 0, median: 0, p95: 0, max: 0, samples }
}
return {
count: samples.length,
median: percentile(samples, 0.5),
p95: percentile(samples, 0.95),
max: samples.at(-1),
samples
}
}
function percentile(sorted, fraction) {
return sorted[Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1)]
}
export function round(value) {
return Math.round(value * 100) / 100
}