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.
| Metric | Recommended threshold |
|---|---|
| Initial JS bundle compressed | Under 200 KB |
| LCP | Under 2.5 seconds |
| CLS | Under 0.1 |
| INP | Under 200 ms |
| FID | Under 100 ms |
| Total page weight | Under 1 MB |
| Time to Interactive | Under 4 seconds |
| Number of requests | Under 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
| Pattern | Detail |
|---|---|
| Lighthouse CI on every PR | Core Web Vitals enforced |
| Size limit check | Bundle size enforced |
| Per route budgets | Different routes have different thresholds |
| Field metric tracking | RUM data informs reality |
| Exception process | Documented and visible |
| Quarterly review | Adjust budgets as needed |
| Dynamic imports | Heavy code not on initial load |
| Performance regression alerts | Catch 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
- No budget. Performance drifts.
- Budget without CI enforcement.
- No field metric tracking. Lab only.
- No exception process. Either too rigid or invisibly bypassed.
- Bundle on first load includes everything.
- No per route budgets.
- No quarterly review. Budgets get stale.
- Treating performance as a quarterly project rather than a continuous discipline.
A two week setup plan
- Week one. Pick the metrics and thresholds. Document the budget.
- 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.
Frequently asked
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.
Posts that line up with this one.
- Performance Optimization
Font Loading: The Subtle Discipline That Improves LCP
Font loading sounds boring and matters more than most engineers realize. The fonts that arrive late shift the layout and slow the LCP. The patterns that fix this are small and well known.
- Performance Optimization
The Caching Hierarchy: Browser, CDN, Edge, Application, Database
Every web application has five caching layers. Understanding which one to use for which data is how fast applications stay fast at scale.
- Performance Optimization
The Cost of Over-Caching: Stale Data Stories
Caching solves performance problems. Over-caching creates correctness problems. Here is the taxonomy of stale data bugs and how to prevent them.
- Performance Optimization
Image Optimization at Scale: AVIF, WebP, Responsive Images
Images are the largest contributor to page weight on most web products. Here is the format selection, responsive image, and delivery strategy that cuts load time without manual work.