Monitoring and Speed · Chapter 4 of 4 · 4 min

Lighthouse and Speed Budgets

Measuring speed automatically after every deploy, what the numbers mean, a real before-and-after from this site, and turning measurements into a budget.

Why measure in CI

Speed slips one small change at a time: a new font, a bigger picture, one more script. Nobody notices a 100-millisecond loss. Ten of them make a slow site. The only defence is to measure automatically, after every change, and keep the history.

What Lighthouse measures

Lighthouse, Google's open-source auditing tool, loads a page in a controlled browser and reports scores from 0 to 100 for performance, accessibility, best practices and SEO, plus the timings behind performance:

Metric Plain meaning Good on mobile
First Contentful Paint (FCP) When anything appears under 1.8 s
Largest Contentful Paint (LCP) When the main content appears under 2.5 s
Total Blocking Time (TBT) How long scripts freeze the page under 200 ms
Cumulative Layout Shift (CLS) How much the page jumps while loading under 0.1

How this site runs it

A GitHub Actions workflow:

The workflow runs on GitHub's servers outside India, on simulated slow hardware. The numbers are best for comparing over time, not as the speed a reader in India actually experiences.

A real before and after

Speed tracking started on the same evening as a change that stopped the site's web fonts from blocking the first paint (the fonts were loaded from a stylesheet import, which made the browser wait). In the first runs, mobile performance scores sat in the high 70s to low 80s, with the largest paint around 4.5 to 5.5 seconds. In the runs since, most scores sit in the mid-to-high 90s with the largest paint around 2 to 3 seconds. Blocking time is close to zero and layout shift is effectively nil.

Two honest caveats: several other changes merged that same evening, so the fonts change cannot take all the credit; and the "before" sample is only a few runs. That is the normal state of real-world measurement. It is still far better than no measurement.

Reading the chart

From measurement to budget

A speed budget is a limit you agree to stay within. A sensible starting budget for this site's measured pages, based on its own history:

Metric Budget
Performance score 90 or above (seven-day median)
Accessibility score 95 or above
Largest paint 2.5 s or less
Blocking time 100 ms or less
Layout shift 0.05 or less

Start by showing breaches on the dashboard. Once the numbers are stable, make the workflow fail when a budget is broken for two runs in a row, so a slow change gets the same red cross as a failing test.

What usually makes a page slow

Try it yourself

Run Lighthouse on your three most important pages today, three times each, and note the median. That is your baseline. Then set one budget, for the largest paint, and check it after every change for a month.