Yashveer Singh
Connect
<- All posts
Performance Optimization11 min read

Frontend Performance Budgets: A Pattern That Sticks

A frontend performance budget is a documented threshold for specific metrics that the team commits not to exceed. Bundle size. LCP. CLS. INP. The budget is enforced in CI so regressions block the build. Without enforcement the budget is a wish. With enforcement the team holds performance over years rather than letting it drift down release by release.

Written by Yashveer Singh, founder of Yashveer Labs.

What you actually need to know

  • Budget for bundle size, LCP, CLS, INP, and total page weight.
  • Enforce in CI. PRs fail when budget is exceeded.
  • Track both lab and field metrics.
  • Document the exception process.
  • Dynamic import heavy code to keep the initial bundle within budget.
MetricRecommended threshold
Initial JS bundle compressedUnder 200 KB
LCPUnder 2.5 seconds
CLSUnder 0.1
INPUnder 200 ms
FIDUnder 100 ms
Total page weightUnder 1 MB
Time to InteractiveUnder 4 seconds
Number of requestsUnder 50 per page

The core argument

Frontend performance budgets are one of those engineering disciplines that prevent slow drift over years. Without the budget the bundle grows. Each PR adds a few kilobytes. None of the additions are individually large. The cumulative effect is a bundle that has doubled in size over a year. The site is slower. The team did not notice because each step was small.

The fix is documented thresholds enforced in CI. The bundle size cannot grow past the threshold. The Core Web Vitals cannot regress past the threshold. The CI fails the build when a regression crosses the line. The team has to address the issue before merging. The slow drift cannot happen.

The setup is small. Lighthouse CI for Core Web Vitals. A bundle size check for the bundle. Both run on every PR. The configuration is roughly a sprint for a team without it. The ongoing maintenance is small. The benefit is performance that does not drift.

The discipline is in handling exceptions. Some changes genuinely require more bundle. The exception process makes the cost visible. The reviewer approves with justification. The exception is logged. The team revisits the budget if exceptions become frequent. The discipline is to make exceptions deliberate rather than silent.

The teams that adopt this stop having quarterly performance crises. The performance is healthy because the budget caught the regressions when they were introduced. The teams that skip this find themselves in a performance project every six months because the cumulative drift has produced an unusable site.

The patterns that work

PatternDetail
Lighthouse CI on every PRCore Web Vitals enforced
Size limit checkBundle size enforced
Per route budgetsDifferent routes have different thresholds
Field metric trackingRUM data informs reality
Exception processDocumented and visible
Quarterly reviewAdjust budgets as needed
Dynamic importsHeavy code not on initial load
Performance regression alertsCatch issues fast

How much does this cost

The cost of the setup is roughly a sprint of work. The ongoing cost is the handful of PRs that need exception conversations or rework to fit the budget. The savings is the performance crises that do not happen.

Features the budget system must have

  • Documented budgets per metric per route.
  • CI enforcement that fails the build.
  • Field metric tracking via RUM.
  • An exception process that is visible.
  • A quarterly budget review.
  • Dynamic import discipline.
  • Performance regression alerts.
  • A retrospective on misses.

Expert opinion

Performance budgets enforced in CI are the cheapest way to hold frontend performance over years. The setup is small. The enforcement removes the politics from individual PR conversations. The reviewer is not arguing with the engineer about bundle size. The CI is. The team has to address the issue or get an exception. The discipline is mechanical and effective.

>

Yashveer Singh, founder of Yashveer Labs

How this played out on a real project

A client SaaS had let frontend performance drift over two years. The LCP had grown from 1.8 seconds to 4.1 seconds. The bundle had grown from 200 KB to 540 KB. The team was facing a quarterly performance project to recover.

We set up performance budgets in CI. Lighthouse CI for the Core Web Vitals. Size limit for the bundle. We brought the metrics back to budget with a focused project. The budget then held the metrics across the next year of feature work.

The team did not have to spend another quarter on performance recovery. The PRs that would have caused regressions were rejected by CI. The engineers either fit the new code into the budget or got an exception. The slow drift stopped.

For more on the related work, see the real numbers behind a fast web app in 2026 and bundle size the quiet killer of mobile web performance.

Common mistakes teams make

  1. No budget. Performance drifts.
  2. Budget without CI enforcement.
  3. No field metric tracking. Lab only.
  4. No exception process. Either too rigid or invisibly bypassed.
  5. Bundle on first load includes everything.
  6. No per route budgets.
  7. No quarterly review. Budgets get stale.
  8. Treating performance as a quarterly project rather than a continuous discipline.

A two week setup plan

  1. Week one. Pick the metrics and thresholds. Document the budget.
  2. Week two. Set up Lighthouse CI and size limit. Wire to PR gating. Train the team.

For more on the related work, read the real numbers behind a fast web app in 2026 and bundle size the quiet killer of mobile web performance. On the broader performance side, the performance regression that hides in CI is the natural next read.

FAQ

Frequently asked

Author

The person behind Yashveer Labs

Yashveer Singh, founder of Yashveer Labs. I build full stack systems for clients who care that the thing actually works two years later, not just on launch day. The arc I am on points at machine learning, AI engineering, and cybersecurity. Everything I write here comes from the codebase, not from a content brief. That is the difference and it shows.

Related reading