pre-bemis

This commit is contained in:
Marcelo
2026-04-22 05:04:19 +00:00
parent ac1a7900c8
commit 80d27f83b6
91 changed files with 11769 additions and 820 deletions

18
lib/perf/serverTiming.ts Normal file
View File

@@ -0,0 +1,18 @@
import { performance } from "perf_hooks";
export const PERF_LOGS_ENABLED = process.env.PERF_LOGS === "1";
export function nowMs() {
return performance.now();
}
export function elapsedMs(startMs: number) {
return Math.round((performance.now() - startMs) * 100) / 100;
}
export function formatServerTiming(entries: Record<string, number>) {
return Object.entries(entries)
.filter(([, value]) => Number.isFinite(value))
.map(([name, value]) => `${name};dur=${value.toFixed(1)}`)
.join(", ");
}