DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
  1. Home
  2. Articles
  3. Frontend Engineering
  4. Performance Budgets: Setting and Enforcing Web Performance Goals
XLinkedInReddit
Frontend Engineering

Performance Budgets: Setting and Enforcing Web Performance Goals

D
DevPrep Team
February 10, 2026·1 min read·0
Table of Contents
  • What to Budget
  • Quantity-Based Budgets
  • Timing-Based Budgets
  • Enforcing in CI
  • Webpack Bundle Analysis
  • Common Budget Violations
  • Monitoring in Production

A performance budget is a set of limits on metrics that affect user experience. Without budgets, performance degrades with every feature addition.

What to Budget

Quantity-Based Budgets

Total JavaScript: < 200KB gzipped
Total CSS: < 50KB gzipped
Total images: < 500KB
Total page weight: < 1MB
Number of requests: < 50

Timing-Based Budgets

Time to Interactive (TTI): < 3.5s on 4G
Largest Contentful Paint (LCP): < 2.5s
First Contentful Paint (FCP): < 1.8s
Interaction to Next Paint (INP): < 200ms
Cumulative Layout Shift (CLS): < 0.1

Enforcing in CI

// bundlesize config (package.json)
{
  "bundlesize": [
    { "path": "dist/js/*.js", "maxSize": "200 kB" },
    { "path": "dist/css/*.css", "maxSize": "50 kB" }
  ]
}

// Lighthouse CI
// .lighthouserc.js
module.exports = {
  ci: {
    assert: {
      assertions: {
        "first-contentful-paint": ["error", { maxNumericValue: 1800 }],
        "interactive": ["error", { maxNumericValue: 3500 }],
        "largest-contentful-paint": ["error", { maxNumericValue: 2500 }],
        "cumulative-layout-shift": ["error", { maxNumericValue: 0.1 }],
        "total-byte-weight": ["warning", { maxNumericValue: 1000000 }]
      }
    }
  }
};

Webpack Bundle Analysis

// Install
npm install --save-dev webpack-bundle-analyzer

// Add to webpack config
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
plugins: [new BundleAnalyzerPlugin()]

// For Vite
npx vite-bundle-visualizer

Common Budget Violations

ViolationCommon CauseFix
JS too largeImporting entire lodashimport { debounce } from "lodash-es"
CSS too largeUnused stylesPurgeCSS / Tailwind purge
Images too largeUnoptimized imagesWebP/AVIF, responsive images
Too many requestsNo code splitting strategyDynamic imports, lazy loading

Monitoring in Production

  • Real User Monitoring (RUM) with web-vitals library
  • Synthetic monitoring with Lighthouse CI
  • Set up alerts when metrics exceed thresholds
  • Track metrics over time in dashboards

Related Articles

MediumFrontend Engineering

System Design #12: Design a Multi-Step Form Wizard

7 min read
MediumFrontend Engineering

Mastering Senior-Level JavaScript Interview Concepts

2 min read
MediumFrontend Engineering

System Design #9: Design a Collaborative Text Editor

9 min read

Comments (0)

Sign in to leave a comment.

No comments yet. Be the first to comment.

Table of Contents

  • What to Budget
  • Quantity-Based Budgets
  • Timing-Based Budgets
  • Enforcing in CI
  • Webpack Bundle Analysis
  • Common Budget Violations
  • Monitoring in Production

Series

View all Frontend Engineering articles →

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.