We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86e006b commit aada045Copy full SHA for aada045
1 file changed
scripts/lib/bench-timing.ts
@@ -81,6 +81,9 @@ export async function timeMedianWithValue<T>(
81
const value = await fn(i);
82
samples.push({ ms: performance.now() - start, value });
83
}
84
+ if (samples.length === 0) {
85
+ throw new Error('timeMedianWithValue: runs must be >= 1');
86
+ }
87
samples.sort((a, b) => a.ms - b.ms);
88
return samples[Math.floor(samples.length / 2)];
89
0 commit comments