Lesson 3 of 9 · 21m
Interaction Metrics and Budgets That Engineers Can Act On
Define measurable interaction budgets, instrument route transitions and critical actions, and prevent vague performance work with explicit thresholds.
Performance work fails the way security work fails: a vague value statement with no operational threshold. "Fast" is not testable. "Search feedback visible in 100 ms on a mid-range phone at p90" is. Budgets turn performance from a vibe into an engineering constraint.
Choose interactions, not pages
Pages are containers. Users experience actions. Build an interaction inventory before setting budgets:
cold load /dashboard first useful paint
login -> first dashboard render sign-in completion
type in global search input feedback + results
open ticket detail route transition
scroll invoice table frame consistency
save settings form optimistic or confirmed feedbackInput feedback often deserves a 50-100 ms budget. Route transitions may get a few hundred milliseconds depending on data expectations. Expensive operations need immediate acknowledgment even when completion takes longer.
Measure interaction to useful paint
The Event Timing API can expose processing duration and delay where browser support exists:
new PerformanceObserver(list => {
for (const entry of list.getEntries()) {
sendMetric('interaction-delay', {
duration: entry.duration,
route: location.pathname,
})
}
}).observe({type: 'event', durationThreshold: 40, buffered: true})Do not pretend this is perfect attribution. It is a signal. The useful pattern is consistent instrumentation before and after changes.
Budget causes, not only outcomes
A single performance budget hides causes. Track several dimensions:
route JavaScript gzip < 180 KB initial dashboard
interaction input latency p75 < 100 ms on reference mobile
list rows mounted < 300 DOM rows at once
route transition p75 < 400 ms with cached shell
image bytes above fold < 350 KBThese are examples, not universal laws. A media editor can justify more JavaScript than a settings page; the mistake is shipping media-editor JavaScript everywhere.
Put budgets where regressions happen
A budget in a document is a wish. Enforce it in CI and release automation:
bun run build
node scripts/assert-bundle-budgets.mjs dist/assets/*.jsCollect size deltas per route and per chunk. When a pull request adds 40 KB to the shared chunk, make that cost visible while the design can still change.
Expect pressure during growth
Teams rarely regress through carelessness. They regress because ten reasonable features each add a small cost. If a new widget needs a charting dependency, remove an old one, lazy-load the feature, or change the budget deliberately. The important part is making the tradeoff explicit.
Field notes
- A budget without an owner becomes a broken alarm everyone ignores.
- Measure input feedback separately from completion; acknowledgment is part of perceived speed.
- Track p75/p90, not averages. Averages are sedated by fast desktop users.
- Budgets should force design decisions early, not shame engineers after the feature ships.
Was this lesson helpful?