What is a performance budget?
Answer
A performance budget is a set of constraints on performance metrics that a team commits to maintaining. Types of budgets: Timing budgets: LCP < 2.5s, INP < 200ms, CLS < 0.1. Quantity budgets: total JS < 200KB (compressed), total CSS < 50KB, total page weight < 1MB. Rule-based budgets: no images > 100KB, Lighthouse score > 90. Why budgets matter: without explicit limits, performance degrades gradually — feature additions, third-party scripts, and dependencies accumulate. A budget creates accountability. Enforcing budgets: Lighthouse CI: block PRs that exceed budget. Configure in lighthouserc.json. Bundlesize: fail CI if bundle size grows beyond threshold. webpack performance hints: warn/error in build if bundle exceeds size. Monitoring: alert when real-user data (CrUX) degrades below threshold. Setting a budget: start with current performance as a baseline, set targets at the "good" threshold for Core Web Vitals. Add new features within the budget by removing technical debt or optimizing existing code.
Previous
How does SSR (Server-Side Rendering) improve performance?
Next
What is the impact of third-party scripts on performance?
More Web Performance Questions
View all →- Intermediate How do you optimize React applications for performance?
- Intermediate What is the browser performance API and how do you measure performance?
- Intermediate What is layout thrashing and how do you avoid it?
- Intermediate What is resource prioritization in browsers?
- Intermediate How does SSR (Server-Side Rendering) improve performance?