Three Metrics, Three Measurement Models
「The site feels slow」 cannot be measured, so it cannot be fixed. Google splits it into three quantifiable metrics — LCP (Largest Contentful Paint, loading), INP (Interaction to Next Paint, responsiveness), CLS (Cumulative Layout Shift, visual stability) — with pass lines at 2.5 s / 200 ms / 0.1.
The three lines do not share a measurement model: which data counts, where each metric's bottleneck sits, and which segment pays best when fixed. For the full chain — critical rendering path, assets, caching, protocols — see the web performance guide.
All three are judged at the P75 percentile (75% of visits pass), not the average. Averaging lets fast devices hide slow users; a site can look healthy on average and fail at P75.
Lab vs Field: The Division of Work
| Lab (Lighthouse / DevTools) | Field (CrUX / web-vitals library) | |
|---|---|---|
| Environment | Fixed device/network/location, reproducible | Real devices/networks, not reproducible |
| Sampling | Single run | 28-day rolling aggregate |
| Metrics | All (incl. LCP/CLS) | LCP/INP/CLS/FCP/TTFB |
| Use | Locate problems (call stacks, waterfalls) | Confirm impact (real distribution) |
| Trap | Nice device, optimistic INP | Small samples lack segmentation |
Correct order: field data shows 「INP P75 is over」 → reproduce the interaction in the lab → find the long task → fix → verify in the lab → wait for CrUX to refresh (roughly a 28-day rolling window). Declaring victory after one Lighthouse run grades the easiest device against the worst scenario.
LCP: Four Stages, Locate Before Fixing
LCP is the moment the largest content element in the viewport (image, video, large text block) finishes rendering. It is four stages in series, and each leaves readable evidence:
| Stage | What to read in Performance | Fixes |
|---|---|---|
| ① TTFB | responseStart - startTime |
CDN, caching, edge rendering |
| ② Resource discovery | The LCP resource's own startTime relative to page start |
<link rel="preload"> for the hero image and critical CSS; never inject the hero via JS |
| ③ Resource load | responseEnd - startTime (network plus server) |
Compression, modern formats, fetchpriority='high' |
| ④ Render delay | LCP time minus the resource's responseEnd |
Avoid first-screen JS blocking; font-display: swap |
Measured: production TTFB for three pages of this site (median of 3 runs each) —
curl -s -o /dev/null -w '%{time_starttransfer}\n' https://oltool.net/json-formatter.html
# median of 3 runs → 0.075s
| Page | TTFB (median) | Total |
|---|---|---|
/ (home) |
0.064 s | 0.135 s |
/json-formatter.html |
0.075 s | 0.105 s |
/blog/json-parse-errors.html |
0.073 s | 0.084 s |
TTFB sits at 64–75 ms (EdgeOne edge node), far under the 800 ms warning line ⇒ the server is not the bottleneck; the remaining budget belongs to the hero image and fonts.
Two actions are mandatory for the hero image: fetchpriority='high', and no loading='lazy' — lazy loading waits for layout before requesting and pushes LCP back. For format choice and slicing images to display size, see image format selection.
INP: Three Delay Segments, Find the Longest
INP tracks all interactions (click/keyboard/touch) across the page lifetime, from input to next paint, taking a near-worst value. One interaction's delay has three segments, and you need to know which is long before optimising:
| Segment | Meaning | Typical cause | Fixes |
|---|---|---|---|
| Input delay | Event queues until the handler starts | Main thread held by a long task | Split long tasks, ship less first-screen JS |
| Processing time | The handler itself runs | One click computing, updating the DOM and calling a third party | Optimistic UI, defer heavy work or move it to a Worker |
| Presentation delay | Handler done to next paint | Forced sync layout, style recalculation, large DOM | Batch DOM reads and writes; animate only transform/opacity |
Causes ranked by frequency: long tasks (synchronous JS over 50 ms) blocking everything after them; handlers doing too much; interleaved reads and writes forcing synchronous layout; too many DOM nodes slowing style recalculation.
How to check: record a real interaction in the DevTools Performance panel and look for a long bar on the main thread. If the bar starts after input, a long task ate the response.
CLS: Only Shifts in Input-Free Windows Score
CLS accumulates layout-shift scores inside session windows without user input (1500 ms), with the score weighing both the affected area and the distance moved. Two consequences: movement the user caused is not counted, and animation done with transform scores nothing.
Three sources, ranked by fix ROI:
- Unsized images/videos:
<img>withoutwidth/heightoraspect-ratiopushes content down on load — a one-line fix with the biggest payoff; - Dynamically injected content: ad slots, cookie banners and infinite scroll shove existing content away — reserve fixed height or
min-height, and put overlays inposition: fixedso they leave the flow; - Web font swap (FOUT): text reflows when the font arrives — match fallback metrics with
size-adjust, or usefont-display: optional.
Reproducible Results
Production TTFB (median of 3 runs, direct with --noproxy):
for i in 1 2 3; do
curl -s -o /dev/null -w '%{time_starttransfer}\n' https://oltool.net/json-formatter.html
done | sort -n | sed -n 2p
# → 0.075
Performance API full chain (paste into DevTools Console on any page):
const t = performance.getEntriesByType('navigation')[0];
const fcp = performance.getEntriesByType('paint').at(-1)?.startTime ?? 0;
console.log({
ttfb: Math.round(t.responseStart - t.startTime),
fcp: Math.round(fcp),
domContentLoaded: Math.round(t.domContentLoadedEventEnd - t.startTime),
load: Math.round(t.loadEventEnd - t.startTime),
});
// This site, production: { ttfb: 64, … } (far below the 800ms warning line)
LCP is not in that object; read it separately with performance.getEntriesByType('largest-contentful-paint').at(-1). The gap between TTFB and LCP is the sum of stages ②③④ above — a large gap means the problem is assets, not the server.
CLS/INP need the web-vitals library (Performance API does not expose INP):
import { onLCP, onINP, onCLS } from 'web-vitals';
onLCP(console.log); onINP(console.log); onCLS(console.log);
// report to your analytics endpoint; aggregate to P75 for CrUX-comparable data
Three steps, ranked by payoff: give every image and video explicit dimensions first (one line each, the cheapest CLS win), then make the hero image fetchpriority='high' and never lazy, then work on JS — defer non-critical scripts and split long tasks with scheduler.yield(). For the network layer (CDN, caching, protocols) and image formats, see the web performance guide.