Skip to content

Commit 1191104

Browse files
committed
chore: reformat profiler
1 parent 0bc66b7 commit 1191104

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

scripts/profile.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,24 +238,34 @@ const allTriggers = Object.keys(BANGS as Record<string, unknown>);
238238
// Cold pass: first-ever call for each trigger, nothing cached yet.
239239
// This is the proxy for "what does a fresh service worker pay on first use?"
240240
const coldT0 = Bun.nanoseconds();
241-
for (const tr of allTriggers) lookupBang(tr);
241+
for (const tr of allTriggers) {
242+
lookupBang(tr);
243+
}
242244
const coldNsPerLookup = (Bun.nanoseconds() - coldT0) / allTriggers.length;
243245

244246
// Warm passes: cache is now fully populated; measure steady-state cost.
245247
const warmTimes: number[] = [];
246248
for (let run = 0; run < RUNS; run++) {
247249
const t0 = Bun.nanoseconds();
248-
for (const tr of allTriggers) lookupBang(tr);
250+
for (const tr of allTriggers) {
251+
lookupBang(tr);
252+
}
249253
warmTimes.push((Bun.nanoseconds() - t0) / allTriggers.length);
250254
}
251255
const warmStats = summarizeRuns(warmTimes);
252256

253-
console.log(`\nAll-triggers cold/warm (${allTriggers.length.toLocaleString()} triggers):`);
257+
console.log(
258+
`\nAll-triggers cold/warm (${allTriggers.length.toLocaleString()} triggers):`
259+
);
254260
console.log(` Cold pass (1×): ${fmt(coldNsPerLookup)}/lookup`);
255261
console.log(` Warm p50 (${RUNS}×): ${fmt(warmStats.p50)}/lookup`);
256262
console.log(` Warm p90: ${fmt(warmStats.p90)}/lookup`);
257-
console.log(` Cold/warm ratio: ${(coldNsPerLookup / warmStats.p50).toFixed(1)}×`);
258-
console.log(` Run spread: ${fmt(warmStats.min)}..${fmt(warmStats.max)} (cv ${warmStats.cvPct.toFixed(1)}%)`);
263+
console.log(
264+
` Cold/warm ratio: ${(coldNsPerLookup / warmStats.p50).toFixed(1)}×`
265+
);
266+
console.log(
267+
` Run spread: ${fmt(warmStats.min)}..${fmt(warmStats.max)} (cv ${warmStats.cvPct.toFixed(1)}%)`
268+
);
259269

260270
// ---------------------------------------------------------------------------
261271
// 3. BANG LOOKUP PERFORMANCE

0 commit comments

Comments
 (0)