MCPcopy Index your code
hub / github.com/epicweb-dev/epic-stack / createTimer

Function createTimer

app/utils/timing.server.ts:26–38  ·  view source on GitHub ↗
(type: string, desc?: string)

Source from the content-addressed store, hash-verified

24}
25
26function createTimer(type: string, desc?: string) {
27 const start = performance.now()
28 return {
29 end(timings: Timings) {
30 let timingType = timings[type]
31
32 if (!timingType) {
33 timingType = timings[type] = []
34 }
35 timingType.push({ desc, time: performance.now() - start })
36 },
37 }
38}
39
40export async function time<ReturnType>(
41 fn: Promise<ReturnType> | (() => ReturnType | Promise<ReturnType>),

Callers 2

timeFunction · 0.85
cachifiedTimingReporterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected