Skip to article
Documentation

src/lib/perf/budgets.ts

Linked repository file from this build.

/**
 * Performance targets for measuring current behavior and guiding decisions.
 *
 * Data budgets are encoded JSON unless the name says gzip. Compute budgets are
 * median milliseconds after warmup. Page budgets are production (Playwright).
 */
export const budgets = {
  oneReviewJson: 8_000,
  oneReviewGzip: 3_000,
  catalogPageJson: 16_000,
  catalogPageGzip: 6_000,
  reportsGzip: 24_000,
  createDemoSeedMs: 8,
  resetBatchMs: 80,
  keystrokeMs: 8,
  applyFinalMs: 8,
  reportMonthMs: 50,
  dbReportMs: 400,
  dbInboxMs: 80,
  dbCatalogMs: 80,
  dbLoadMs: 40,
  inboxApi: 24_000,
  catalogApi: 40_000,
  oneReviewApi: 48_000,
  // A full workflow retains up to three received copies; allow another 48 KB for those facts.
  oneReviewWithReceivedCopiesApi: 96_000,
  reportsApi: 80_000,
  exportsApi: 16_000,
  searchApi: 40_000,
  fontPreloads: 2,
} as const;

/** Decision targets, not claims about current performance. Every sample is gated. */
export const browserBudgets = {
  local: { cold: 1_500, navigation: 500 },
  internet: { cold: 2_500, navigation: 1_000 },
  wireBytes: { cold: 1_000_000, navigation: 150_000 },
  apiJsonBytes: 120_000,
} as const;