MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / measure

Function measure

apps/desktop/src/main/vault.perf.test.ts:30–40  ·  view source on GitHub ↗
(
  label: string,
  detail: Record<string, unknown>,
  fn: () => Promise<T>
)

Source from the content-addressed store, hash-verified

28})
29
30async function measure<T>(
31 label: string,
32 detail: Record<string, unknown>,
33 fn: () => Promise<T>
34): Promise<{ value: T; durationMs: number }> {
35 const startedAt = performance.now()
36 const value = await fn()
37 const durationMs = Math.round((performance.now() - startedAt) * 100) / 100
38 console.info(`[zen:bench] ${label} ${durationMs.toFixed(2)}ms`, detail)
39 return { value, durationMs }
40}
41
42async function seedLargeVault(root: string): Promise<void> {
43 await ensureVaultLayout(root)

Callers 1

vault.perf.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected