DO TRUNG DUNG

Performance / Note 02 / 2026 / 1 min read

Using a Performance Budget in a Frontend Build

A performance budget gives me something concrete to check when images, JavaScript or interactions start getting heavier.

Make the limit visible

A page usually becomes slow through several small changes rather than one obvious mistake. Images get heavier, more JavaScript is added, or an interaction starts waiting on data it did not need before.

A performance budget gives those changes a number to push against. It does not decide what the product should contain, but it makes the cost of a change easier to see.

Budget the expensive parts

The useful limits depend on the project. I usually care about route JavaScript, large images and interaction latency because those are easy places for a frontend to become noticeably heavier.

TypeScript
interface PerformanceBudget {
  routeJavaScriptKb: number;
  criticalImageKb: number;
  interactionLatencyMs: number;
}

Check again after changes

A budget is most useful when it is checked during normal development or release verification. Otherwise it becomes another document that is easy to forget once the site changes.