Setting Performance Budgets
What you'll learn: You'll learn how to define concrete, measurable performance targets that guide when and where to optimize your code.
The Core Idea
A performance budget is a set of numerical limits you decide on before you start optimizing. Think of it like a financial budget—you set spending limits for different categories. With performance, you set limits for metrics like load time, JavaScript execution time, bundle size, or memory usage.
Without budgets, you'll either optimize forever (chasing diminishing returns) or ship code that's unacceptably slow to real users. Budgets give you clear thresholds: if you're under budget, ship it; if you're over, investigate.
Why Budgets Matter
Based on what you learned in The 80/20 Rule in Performance Work and Identifying Real Performance Problems, you know not all slowdowns matter equally. Budgets help you focus on user-perceivable metrics rather than arbitrary millisecond improvements.
Common Budget Categories
- Load Time Budgets: "First Contentful Paint must be under 1.5s on 3G"
- Bundle Size Budgets: "Total JavaScript must be under 200KB gzipped"
- Runtime Budgets: "Page interactions must respond within 100ms"
- Memory Budgets: "Heap size must stay under 50MB during typical use"
Setting Realistic Budgets
Base your budgets on:
- Real user data (from Performance Observer API or RUM metrics you've learned)
- Competitive benchmarks (what similar sites achieve)
- User expectations (research shows 3s load time is a common tolerance threshold)
Don't pick numbers arbitrarily—tie them to business goals (conversion rates, user retention) whenever possible.
Key Takeaway: Performance budgets transform vague "make it faster" goals into concrete, measurable targets that tell you exactly when optimization work is necessary and when it's done.