Nexova / src /lib /timing.ts
Nexova
feat: query timing on all APIs, benchmark tab, responsive UI
dab3de7
raw
history blame contribute delete
209 Bytes
export async function timed<T>(fn: () => Promise<T>): Promise<{ data: T; ms: number }> {
const t = performance.now();
const data = await fn();
return { data, ms: +(performance.now() - t).toFixed(2) };
}