Running a performance audit
Audit a whole site the same way each time: read field data, pick pages and devices by visits and distance past the line, reproduce in the lab, rank fixes.
- 01Start from field dataRead the p75 of LCP, INP and CLS for every page on phones and on computers, before opening a lab tool.
- 02Choose where to lookRank pages and devices by their share of visits times how far past the line they are, and take the top ones to the lab.
- 03Reproduce, find the cause, and rankMatch the lab to the field with DevTools' advice, read the cause in a trace, and rank fixes by visits helped per hour of work.
Where do you start with a whole shop?
It's Monday at the Leaf and Kettle. Asha sends Ravi a message from the bus. "Your home page is so slow on my phone. The words come, then I wait and wait for the photo."
Ravi's shop has five pages: the home page, the tea list, the Mint tea page, the reviews and the cart. People visit on phones and on computers. That's ten places to look, with three numbers each. So where should he start? With Asha's page? With the worst number? With the busiest page?
First, here is what Asha saw. The course loaded the home page on "Asha's phone" from earlier lessons: a phone's screen, a slow network and a slow processor.
The words came after about a second. Then the photo filled in from the top, a strip at a time. It was whole after 6.4 seconds. Why it matters: Asha could read the page, but its main picture took five seconds more.
Is Asha unlucky, or does everyone wait? Ravi's pages send home numbers from every real visit. Here is the home page on phones:
// p75 of the home page on phones, from Ravi's field dataconst home = { LCP: 4896, INP: 8, CLS: 0 };const good = { LCP: 2500, INP: 200, CLS: 0.1 }; for (const metric of ["LCP", "INP", "CLS"]) { const verdict = home[metric] <= good[metric] ? "good" : "over the line"; console.log(`${metric}: ${home[metric]}, ${verdict}`);}- Line 1 is a comment. p75 is the 75th percentile: three visits in four were at or under it.
- Line 2 holds the home page's p75 on phones for three numbers. LCP is when the biggest image or text appears. INP is how long the page takes to answer a tap. CLS adds up how much the page jumps.
- Line 3 holds Google's line for good on each one: 2,500 ms, 200 ms and 0.1. A millisecond (ms) is a thousandth of a second.
- Lines 5 to 8 compare each number with its line. They print
LCP: 4896, over the line,INP: 8, goodandCLS: 0, good.
So Asha isn't unlucky. A quarter of phone visits waited 4.9 seconds or more for the photo. Why it matters: one complaint pointed at a real problem. But Ravi has nine more places to check, and nobody has written to him about those.
He needs a way to check them all, the same way each time. That's a performance audit.
Before Ana buys an old house, an inspector visits. She checks every room, not only the one with the damp patch Ana noticed. She writes down what she finds. Then she gives Ana a list: fix the roof first, the paint can wait.
- In real life: Every room in the house
- In an audit: Every page, on phones and on computers
- In real life: The damp patch Ana noticed
- In an audit: Asha's message about the home page
- In real life: The inspector's notes, room by room
- In an audit: Field data for each page and device
- In real life: "Fix the roof first, the paint can wait"
- In an audit: The fixes, ranked by impact and effort
A performance audit has five steps. Read the field data for every page and device. Choose where the most visits wait the longest. Make that wait happen in the lab. Find its cause in a trace. End with the fixes ranked by how many visits each one helps per hour of work. Field data says where. The lab says why. The list says what to do first.
Here are the five steps, with what each one gave Ravi:
The rest of the lesson takes one step at a time. Lesson 12.7 took one field problem all the way to a fix. An audit comes before that: it finds which problems to take there first.
How the course recorded it
- The shop: Ravi's five pages, built for this lesson. They were served over HTTPS from the course's computer, at a made-up address. The course put four problems in them on purpose. Try not to guess them yet: the steps will find them.
- The visitors: 320 visits in Ravi's mix. The home page had 96, the Mint tea page 80, the tea list and the cart 64 each, and the reviews 16. 226 came from phones. Each phone and computer had its own speed and network, drawn the way lesson 13.1 drew them.
- Each visit: the visitor waited for the page to settle, tapped one button, and left. The page sent its numbers home with the web-vitals library, as in lesson 12.4.
- The lab: Chrome 157 as Asha's phone: Lighthouse's phone screen and DevTools' throttling. Each setting loaded five times, taking turns, after one round that wasn't kept. The lesson quotes the middle load. Its traces were read with DevTools' own trace engine, the code behind the Performance panel.
Start from field data
Field data is numbers from real visits, on real phones and real networks. A lab run is one visit, on a setup you chose. web.dev's LCP guide says to look at "what real users are experiencing, rather than what a lab-based tool like Lighthouse or local testing shows."
Ana wants to change her café's menu. She could guess what people like. Instead, she reads a week of receipts. They show what people really ordered, at which table, and when. Her own ideas come later, when she tries a recipe in her kitchen.
- In real life: A week of receipts
- In an audit: The beacons from real visits
- In real life: The table and the time on each receipt
- In an audit: The page and the device in each beacon
- In real life: Adding up the receipts table by table
- In an audit: A p75 for each page on each device
- In real life: Trying a new recipe in her own kitchen
- In an audit: A lab run, later
Two places field data comes from
The first is CrUX, the Chrome User Experience Report from lesson 10.1. It's free, but it has limits. It only has a page when that page has enough visitors. Otherwise, it only has the whole site: the origin. PageSpeed Insights shows CrUX for phones and for desktops. When a page has no data of its own, it shows the origin's.
The second is your own RUM, real-user monitoring, from lesson 12.4. A small shop like Ravi's needs it, because CrUX can't tell his pages apart. Read this table across: each row asks one question of both.
| Question | CrUX | Ravi's RUM |
|---|---|---|
| Which pages? | Only pages with enough visitors. Otherwise, only the whole site: the origin. | Every page that loads rum.js. |
| Which devices? | Phones, tablets and computers, told apart by the browser's user agent. | Whatever the beacon says. Ravi's says phone or computer, from the screen's width. |
| Which browsers? | Chrome on computers and Android, from people who share usage statistics. | Every browser, for each number it can measure. |
| Does it say why? | A little: for LCP, its four parts and the kind of element. | Yes: the element and the parts, from web-vitals' attribution build. |
| How fresh is it? | It covers the last 28 days. | As fresh as the last visit. |
What Ravi's beacon sends
Each page loads one small script, rum.js. It uses the web-vitals library's attribution build, which also says where each number's time went.
// rum.js: sends each visit's Core Web Vitals home when the page is hidden.const visit = { page: document.body.dataset.page, device: matchMedia("(max-width: 600px)").matches ? "phone" : "desktop", rtt: navigator.connection?.rtt ?? null, metrics: {},}; webVitals.onLCP(({ value, attribution: a }) => { visit.metrics.LCP = { value, element: a.target, parts: [a.timeToFirstByte, a.resourceLoadDelay, a.resourceLoadDuration, a.elementRenderDelay] };});webVitals.onINP(({ value, attribution: a }) => { visit.metrics.INP = { value, element: a.interactionTarget, parts: [a.inputDelay, a.processingDuration, a.presentationDelay] };});webVitals.onCLS(({ value, attribution: a }) => { visit.metrics.CLS = { value, element: a.largestShiftTarget ?? null };}); addEventListener("visibilitychange", () => { if (document.visibilityState === "hidden") navigator.sendBeacon(`/rum${location.search}`, JSON.stringify(visit));});- Lines 2 to 7 make the visit's record. Line 3 is the page. Line 4 is the kind of device, from the screen's width.
- Line 5 is the round-trip time: how long a message takes to reach a server and come back. Chrome works it out from recent connections. It rounds it to 50 ms and changes it a little, so sites can't use it to tell people apart. You'll need it in the lab.
- Lines 9 to 17 keep each metric with its note: the element, and the parts of the wait.
- Lines 19 to 21 send the record when the page is hidden, with
navigator.sendBeacon().
Every page, on every device
web.dev says to read each metric at the 75th percentile, "segmented across mobile and desktop devices." A segment is one group of visits: here, one page on one kind of device. Five pages on two kinds of device make ten segments. Pick a metric, and read all ten:
- Home, phones (72 visits)4,896 ms: poor
- Home, computers (24 visits)144 ms: good
- Tea list, phones (48 visits)664 ms: good
- Tea list, computers (16 visits)172 ms: good
- Mint tea, phones (56 visits)592 ms: good
- Mint tea, computers (24 visits)140 ms: good
- Reviews, phones (10 visits)1,632 ms: good
- Reviews, computers (6 visits)1,156 ms: good
- Cart, phones (40 visits)560 ms: good
- Cart, computers (24 visits)132 ms: good
Each row is the p75 of one page on one kind of device. Good up to 2,500 ms. Poor over 4,000 ms. A marked row is over the good line.
Five segments are over a line. The home page on phones is over for LCP. The tea list on phones is over for INP. The reviews page is over for CLS, on phones and on computers. The cart on phones is just over for INP. Every other number is good.
The notes tell Ravi more than CrUX could. Here is the visit at the p75 of two segments:
// The visit at the p75 of two segments, as its beacon sent it, in msconst home = { element: "html>body>main>img.hero", LCP: 4896, parts: [41, 135, 4697, 23] };const teas = { element: "html>body>main>div.filters>button", INP: 376, parts: [0, 332, 44] }; const share = (part, whole) => Math.round((part / whole) * 100);console.log(`Home: ${home.element}, its download ${share(home.parts[2], home.LCP)}% of LCP`);console.log(`Tea list: ${teas.element}, processing ${share(teas.parts[1], teas.INP)}% of INP`);- Line 2 is a home page visit. Its
elementis the LCP element. Its fourpartsare the parts of LCP from lesson 17.2: the first byte, the delay before the photo starts, its download, and the delay before it's painted. - Line 3 is a tea list visit. Its element is the button that was tapped. Its three parts are the phases of a tap from lesson 26.2: waiting to start, running the code, and painting the answer.
- Line 6 prints
Home: html>body>main>img.hero, its download 96% of LCP. - Line 7 prints
Tea list: html>body>main>div.filters>button, processing 88% of INP.
All 72 phone visits to the home page named the photo as their LCP element. Why it matters: before he opens any lab tool, Ravi knows where to look. For the home page, the photo's download. For the tea list, the code behind the filter buttons.
Choose the pages and the visitors
Ravi can't fix everything at once, so he has to choose. Three simple rules come to mind, and they disagree:
- Asha's complaint: the home page. But a complaint only tells you about the people who complain.
- The worst number: the reviews page. Its CLS on phones, 0.26, is 160% past the line.
- The most visits: the home page on phones, then the Mint tea page on phones. But every Mint tea number is good.
web.dev's guide to debugging in the field gives a better rule. Fix first "the issues that are affecting the largest number of users." How bad each problem is counts too.
A road crew has a list of potholes. One is very deep, on a quiet lane. Another is less deep, on the main road into town. The crew counts how many cars hit each one, and how deep it is. The main road comes first: thousands of cars bump through it every day.
- In real life: How many cars drive over it
- In an audit: The segment's share of all visits
- In real life: How deep the hole is
- In an audit: How far its p75 is past the line
- In real life: Cars times depth
- In an audit: The segment's priority
- In real life: The deep hole on a quiet lane
- In an audit: The reviews page
So Ravi gives each segment a priority: its share of all visits, times how far its worst p75 is past the good line.
// Three of the ten segments: share of visits (%), worst p75, and its good lineconst segments = [ { name: "Home, phones", share: 22.5, p75: 4896, line: 2500 }, { name: "Tea list, phones", share: 15, p75: 376, line: 200 }, { name: "Reviews, phones", share: 3.1, p75: 0.26, line: 0.1 },]; for (const s of segments) { const over = Math.round((s.p75 / s.line - 1) * 100); console.log(`${s.name}: ${over}% over, priority ${Math.round((s.share * over) / 10) / 10}`);}- Lines 3 to 5 hold three segments.
shareis the segment's percent of all 320 visits.p75is its worst number, andlineis the good line for that metric. - Line 9 works out how far past the line. 4,896 ms is 1.96 times 2,500 ms, so it's 96% over.
- Line 10 multiplies the share by that distance, and divides by 100. It prints
Home, phones: 96% over, priority 21.6,Tea list, phones: 88% over, priority 13.2andReviews, phones: 160% over, priority 5.
The reviews page is the furthest past its line, but only 10 phone visits saw it. Why it matters: the priority sends the lab to the problems that hurt the most visits, not to the loudest number. Try all three rules on all ten segments:
- 1. Reviews, phones160% past the CLS line
- 2. Home, phones96% past the LCP line
- 3. Tea list, phones88% past the INP line
- 4. Reviews, computers80% past the CLS line
- 5. Cart, phones4% past the INP line
- 6. Mint tea, phonesevery number good
- 7. Home, computersevery number good
- 8. Mint tea, computersevery number good
- 9. Cart, computersevery number good
- 10. Tea list, computersevery number good
Sorted by how far the worst p75 is past its good line. The two marked rows are the ones this rule would take to the lab.
Pages by type, segments by device
Count pages by type, not by address. Every tea's page uses the same template, so they usually share their problems. web.dev warns about one type in particular. New visitors often load the home page "cold", with nothing saved from before. So home pages "are often the slowest pages on a website."
Ravi splits by device first, because Google reads each metric for phones and computers apart. You can split further, by country or by new and returning visitors, as lesson 12.5 did. Each split makes the groups smaller. Keep enough visits behind each p75: with 10 visits, one unlucky phone can move it.
Make the same problem happen in the lab
Field data says where. To see why, Ravi needs the problem on his own computer, where he can record it. web.dev's INP guide puts it plainly: once you "can manually reproduce it in the lab, the next step is to optimize it."
His laptop is fast, and so is his network. A quick try there shows nothing wrong. The home page's LCP is 52 ms, and a tap on the tea list takes 96 ms.
Ana's cake burns every time she bakes it. You bake her recipe in your own oven, and it comes out fine. Then you learn her oven runs much hotter. You set yours to the same heat, and the cake burns. Now you can watch it happen, and find out why.
- In real life: Ana's hot oven
- In an audit: Ravi's visitors' phones and networks
- In real life: Your own gentle oven
- In an audit: Ravi's fast laptop
- In real life: Setting your oven to her heat
- In an audit: DevTools' network and CPU throttling
- In real life: The cake burning in your kitchen
- In an audit: The field's problem, showing in the lab
Let DevTools pick the network
DevTools' Performance panel can show CrUX field data next to your own numbers. Then its Environment settings card gives advice. For the network, it reads the field's 75th percentile round trip. DevTools' code picks the preset whose round trip is closest, as long as it's within 200 ms. Under 60 ms, it says no throttling can match.
Ravi's beacons have round trips too, so he uses the same rule:
// p75 round-trip time from Ravi's beacons, in msconst rtt = { phones: 250, computers: 50 };// DevTools' presets, and the round trip each one stands forconst presets = { "Fast 4G": 60, "Slow 4G": 150, "3G": 400 }; function advice(p75) { if (p75 < 60) return "too fast to simulate with throttling"; const gaps = Object.entries(presets).map(([name, target]) => [name, Math.abs(target - p75)]); const close = gaps.filter(([, gap]) => gap <= 200).sort((a, b) => a[1] - b[1]); return close.length ? `similar to ${close[0][0]} throttling` : "no preset is close";} for (const [who, p75] of Object.entries(rtt)) console.log(`${who}: ${advice(p75)}`);- Line 2 holds the p75 round trip of Ravi's phones and of his computers. Line 4 lists DevTools' presets, with the round trip each one stands for.
- Line 7 stops early for anything under 60 ms. Lines 8 and 9 keep the presets within 200 ms, closest first.
- Line 13 prints
phones: similar to Slow 4G throttlingandcomputers: too fast to simulate with throttling. Those are DevTools' own words.
For the processor, DevTools recommends a 4× slowdown. You can also calibrate a "Mid-tier mobile" setting on your own computer, as lesson 9.3 showed. Ravi takes Slow 4G and 4×. That's the course's Asha's phone.
Check that the lab shows the problem
Now try each setting on both pages. The field's p75 sits next to each lab result:
- Home, phones: LCPlab 52 ms, field 4,896 ms
- Tea list, phones: INPlab 96 ms, field 376 ms
Each row is the lab's middle load of five, next to the field's p75 on phones. A marked row is over the good line in the lab, like the field.
Slow 4G alone makes the photo slow. The slower CPU alone makes the tap slow. Only both together show both problems. Why it matters: a lab that shows one problem can still hide another. Check every segment you picked.
// The field's p75 on phones, and the lab's middle load with Slow 4G and CPU 4× slower, in msconst home = { field: 4896, lab: 6388, line: 2500 };const teas = { field: 376, lab: 272, line: 200 }; for (const [name, s] of [["Home LCP", home], ["Tea list INP", teas]]) { const same = s.field > s.line && s.lab > s.line ? "over the line in both" : "not the same"; console.log(`${name}: field ${s.field}, lab ${s.lab}, ${same}`);}- Lines 2 and 3 hold each segment's field p75, the lab's middle load, and the good line.
- Line 6 checks that both are over the line.
- It prints
Home LCP: field 4896, lab 6388, over the line in bothandTea list INP: field 376, lab 272, over the line in both.
The numbers don't match, and they don't need to. Slow 4G is slower than most of Ravi's phones' networks, so the lab's photo took longer. The field's p75 tap came from a phone whose CPU was 6 times slower, and the lab's was 4 times, so the field's tap took longer. You reproduce the problem, not the number. Lesson 12.7 shows how to turn the dials until the numbers come closer.
Find the cause in a trace
With the problem on his screen, Ravi records a trace in the Performance panel. Its Insights tab, from lesson 7.3, breaks each metric into parts.
The home photo
// DevTools' LCP breakdown of the home page in the lab, in msconst parts = { ttfb: 563.4, loadDelay: 657, loadDuration: 5159.3, renderDelay: 6.6 };const lcp = Object.values(parts).reduce((sum, ms) => sum + ms, 0); for (const [part, ms] of Object.entries(parts)) { console.log(`${part}: ${Math.round((ms / lcp) * 100)}%`);}- Line 2 holds the four parts of LCP, as DevTools' LCP breakdown measured them.
- Line 3 adds them up. Lines 5 to 7 print each one as a share:
ttfb: 9%,loadDelay: 10%,loadDuration: 81%andrenderDelay: 0%.
Four fifths of the wait was the photo's own download. Two more insights say why. "Improve image delivery" says the file could be 809,256 bytes smaller. It's a 1,600 px wide PNG, shown 380 px wide. "LCP request discovery" has two checks that fail. The photo uses loading="lazy", and it has no fetchpriority="high".
So the photo is far too big, and the browser starts it late. Lessons 18.1 to 18.3 cover formats, sizes and loading. Why it matters: the field's note said "download". The trace names the file and the attribute.
The tea list's tap
// DevTools' INP breakdown of the tap on Herbal, in the lab, in msconst tap = { inputDelay: 3.1, processing: 229.7, presentation: 40.2 };const total = tap.inputDelay + tap.processing + tap.presentation; console.log(`The tap took ${Math.round(total)} ms`);console.log(`Processing: ${Math.round((tap.processing / total) * 100)}% of it`);- Line 2 holds the three phases of the tap on Herbal, as DevTools' INP breakdown measured them.
- Line 5 prints
The tap took 273 ms. Line 6 printsProcessing: 84% of it.
Processing is the tap's own code. Here is the code that runs:
function rankTeas(teas) { // Stands in for real work: scoring each tea against last month's orders. let score = 0; for (let i = 0; i < 60000000; i++) score += i % 7; return [...teas].sort((a, b) => b.orders - a.orders);} function showTeas(kind) { const chosen = TEAS.filter((tea) => kind === "all" || tea.kind === kind); list.innerHTML = rankTeas(chosen).map(card).join(""); for (const button of buttons) button.setAttribute("aria-pressed", String(button.dataset.kind === kind));} for (const button of buttons) button.addEventListener("click", () => showTeas(button.dataset.kind));- Lines 1 to 6 are
rankTeas. Line 4's loop stands in for real work, like scoring each tea against last month's orders. Line 5 sorts the teas. - Lines 8 to 12 are
showTeas. Line 10 callsrankTeasduring the tap, then rebuilds the list. - Line 14 runs showTeas on every tap of a filter button.
The new list can't be painted until the loop ends. You can watch it yourself. Open Ravi's tea list in Chrome. In DevTools, set the CPU to a 4× slowdown, record, and tap Herbal.
The two smaller problems
The reviews and the cart came lower on the list. So Ravi reads their notes and their code before he records anything. The reviews' note named the list of reviews as the element that moved. A script asks the server for this week's offer, then puts a banner above the reviews. web.dev's CLS guide lists "dynamically injected content" among the most common causes. The cart's + button works out every total before it shows the new count.
Rank the fixes by impact and effort
The causes suggest 6 fixes. Each one needs two numbers: how much it helps, which is its impact, and how much work it is, its effort.
Guests arrive in an hour. Clearing the table takes five minutes, and every guest will see it. Washing the windows takes an afternoon. Redoing the bathroom tiles takes a weekend, and few guests will notice. You start with the table.
- In real life: How many guests will notice
- In an audit: How many visits a fix brings under the line
- In real life: How long each job takes
- In an audit: Ravi's estimate of the hours
- In real life: The table first, the bathroom never
- In an audit: Visits helped per hour of work
Measure each fix in the lab
Ravi builds each fix and loads it five times with the same setting: Slow 4G and the CPU 4× slower. Read this table across: the fix, what changes, the lab's middle load before and after, and Ravi's estimate of the work.
| Fix | What changes | In the lab | Work |
|---|---|---|---|
| Load the home photo first | Take loading="lazy" off the photo and add fetchpriority="high". | LCP: 6,388 ms, then 5,836 ms | 1 hour |
| Send a smaller home photo | Save the photo as a JPEG at three widths, and list them in srcset. | LCP: 6,388 ms, then 1,856 ms | 4 hours |
| Show the teas, then rank them | Update the list, yield, and only then do the slow ranking. | INP: 272 ms, then 48 ms | 2 hours |
| Rank the teas on the server | Send the list already ranked, so a tap only hides and shows cards. | INP: 272 ms, then 40 ms | 24 hours |
| Put the offer in the HTML | Send the banner with the page, so its space is there from the start. | CLS: 0.26, then 0.00 | 3 hours |
| Show the count, then the total | Update the count, yield, and only then work out the total. | INP: 200 ms, then 40 ms | 2 hours |
Two things stand out. Loading the photo first saved 552 ms, but the photo still spent most of its time downloading. And the two tea list fixes gave almost the same INP. Ranking on the server takes much longer, because the server changes too.
Here is the cheaper one. It updates the list first, and does the slow work after the next paint:
async function showTeas(kind) { const chosen = TEAS.filter((tea) => kind === "all" || tea.kind === kind); list.innerHTML = chosen.map(card).join(""); for (const button of buttons) button.setAttribute("aria-pressed", String(button.dataset.kind === kind)); await yieldToMain(); list.innerHTML = rankTeas(chosen).map(card).join("");}- Lines 2 to 4 show the chosen teas and mark the pressed button, as before.
- Line 5 yields: it lets the browser paint before the rest runs, as lesson 27.2 showed.
- Line 6 ranks the teas afterwards. The ranking takes as long as ever, but the tap already has its answer.
yieldToMain()is a small helper in the file. It usesscheduler.yield()where the browser has it, andsetTimeout()where it doesn't.
From the lab to the field
The lab gives one number before and one after. Ravi wants to know how many real visits each fix would help. So he assumes each field visit changes by the same share as the lab did:
// The smaller home photo in the lab, with Slow 4G and CPU 4× slower: LCP in msconst lab = { before: 6388, after: 1856 };const kept = lab.after / lab.before; // Four phone visits to the home page from the field: LCP in msconst visits = [2440, 2636, 4896, 17928];const helped = visits.filter((lcp) => lcp > 2500 && lcp * kept <= 2500);console.log(`Each LCP keeps ${Math.round(kept * 100)}% of its time`);console.log(`Brought under the line: ${helped.length} of ${visits.length}`);- Line 2 holds the lab's LCP before and with the smaller photo. Line 3 works out the share of the time that's left.
- Line 6 holds four real phone visits to the home page.
- Line 7 keeps the visits that are over the line now, and under it after the fix.
- Line 8 prints
Each LCP keeps 29% of its time. Line 9 printsBrought under the line: 2 of 4.
The first visit was already under the line. The last one was so slow that even 29% of it is too long. Why it matters: a fix's impact is the visits it brings under the line, not the milliseconds it saves in the lab.
Impact per hour
Ravi does that for every fix, on every visit to its page. Then he divides by his estimate of the hours. Sort the fixes three ways:
- 1. Send a smaller home photo40 of 43 visits, 4 h, 10 per hour
- 2. Show the teas, then rank them35 of 35 visits, 2 h, 17.5 per hour
- 3. Rank the teas on the server35 of 35 visits, 24 h, 1.5 per hour
- 4. Put the offer in the HTML16 of 16 visits, 3 h, 5.3 per hour
- 5. Show the count, then the total12 of 12 visits, 2 h, 6 per hour
- 6. Load the home photo first4 of 43 visits, 1 h, 4 per hour
Most field visits brought under the line first. Each row says how many of the page's visits over the line the fix brings under it, Ravi's estimate of the hours, and the visits per hour.
Ravi also draws a simple grid, with four boxes:
By visits per hour, yielding on the tea list comes first, and the smaller photo second. Ranking on the server comes last: the same visits as yielding, for twelve times the work.
Fixes on one page change each other. With both home fixes together, the lab's LCP was 1,304 ms. So Ravi measures again after each fix, and moves the list around. That ranked list is what the audit produces.
Which step of the audit?
Each job below belongs to one step of Ravi's audit. Sort it into its step:
- Read the p75 of LCP, INP and CLS for every page, on phones and on computers
- Count which element each beacon named as the LCP
- Multiply each segment's share of visits by how far it's past the line
- Put the reviews page third, behind two busier segments
- Pick Slow 4G because the phones' p75 round trip is 250 ms
- Record a trace and read the INP breakdown in the Insights tab
- Load each fix five times under the same lab setting
- Divide the visits a fix brings under the line by its hours of work
Sort each job by the step of the audit it belongs to.
Common mix-ups
- "Start with the page someone complained about." No. A complaint is a clue, not a plan. The tea list came second, and nobody had written about it.
- "Start with the worst number." No. The reviews page had the worst CLS, but only 5% of visits. Two busier segments came first.
- "Start with the busiest page." No. The Mint tea page on phones had 56 visits, and every number was good.
- "A good lab result means the page is fine." No. With no throttling, the home page's LCP was 52 ms in the lab. In the field, its p75 on phones was 4,896 ms.
- "The lab has to match the field's number." No. The lab's LCP was 6,388 ms and the field's 4,896 ms. The same element, the same cause, both over the line: that's a match.
- "Lighthouse finds every problem." No. web.dev notes that Lighthouse "does not detect issues that only manifest as a result of user interaction." The tea list's slow tap needs a tap.
- "The fix that saves the most milliseconds goes first." No. Ranking on the server saved the most on the tap. Yielding helped the same visits for a twelfth of the work.
Practice exercises
Answer first, then use the hints.
The cart on phones had 12.5% of visits, and a p75 INP of 208 ms. What does it print?
// One more segment: share of visits (%), worst p75, and its good line
const segments = [
{ name: "Cart, phones", share: 12.5, p75: 208, line: 200 },
];
for (const s of segments) {
const over = Math.round((s.p75 / s.line - 1) * 100);
console.log(`${s.name}: ${over}% over, priority ${Math.round((s.share * over) / 10) / 10}`);
}Cart, phones: 4% over, priority 0.5. The cart is over the line, but only just, so it comes well after the two segments the audit picked.
Another shop's visitors have a p75 round trip of 100 ms. What does DevTools' rule print?
// p75 round-trip time from Ravi's beacons, in ms
const rtt = { visitors: 100 };
// DevTools' presets, and the round trip each one stands for
const presets = { "Fast 4G": 60, "Slow 4G": 150, "3G": 400 };
function advice(p75) {
if (p75 < 60) return "too fast to simulate with throttling";
const gaps = Object.entries(presets).map(([name, target]) => [name, Math.abs(target - p75)]);
const close = gaps.filter(([, gap]) => gap <= 200).sort((a, b) => a[1] - b[1]);
return close.length ? `similar to ${close[0][0]} throttling` : "no preset is close";
}
for (const [who, p75] of Object.entries(rtt)) console.log(`${who}: ${advice(p75)}`);visitors: similar to Fast 4G throttling. Both 4G presets are within 200 ms, and Fast 4G's 60 ms is the closer of the two.
With the CPU 4× slower and no network throttling, what was the tea list's INP in the lab, in ms?
280 ms. The slower CPU alone is enough to show the slow tap, because the tap's time is the CPU running the loop. The network doesn't matter after the page has loaded.
How many visits per hour does "Put the offer in the HTML" bring under the line?
5.3. It brings all 16 reviews visits under the line in about 3 hours. Every reviews visit was over the line, but there were only 16 of them.
Open the home page's trace in DevTools' Performance panel. Which check of LCP request discovery passes?
Request is discoverable in initial document. The photo's <img> is in the HTML, so the preload scanner can find it. The other two checks fail: it's lazy-loaded, and it has no high fetch priority.
Which CrUX API metric gives the share of a site's visits that come from phones, tablets and desktops?
form_factors. It gives the share of page loads from phones, tablets and desktops. DevTools reads it to say what percent of your visitors are on mobile.
Check your understanding
For each question, ask: which step of the audit is this, and what does it need, the field, the lab, or both?
Question 1 of 7Ravi's audit starts from field data, not from a lab run. Why?
Choose an answer to see the explanation.
Question 2 of 7The reviews page had the shop's worst number: a CLS 160% past the line. Why did it come third?
Choose an answer to see the explanation.
Question 3 of 7What does this priority code print for a made-up checkout page?
Read the code, then predict// A made-up segment: share of visits (%), worst p75, and its good line const segments = [ { name: "Checkout, phones", share: 10, p75: 300, line: 200 }, ]; for (const s of segments) { const over = Math.round((s.p75 / s.line - 1) * 100); console.log(`${s.name}: ${over}% over, priority ${Math.round((s.share * over) / 10) / 10}`); }Choose an answer to see the explanation.
Question 4 of 7DevTools says the computers' p75 round trip is too fast to simulate with throttling. What should Ravi's lab for computers do?
Choose an answer to see the explanation.
Question 5 of 7With no throttling at all, the lab's home page LCP was fast. What does that tell Ravi?
Choose an answer to see the explanation.
Question 6 of 7In the matched lab, the home page's LCP was longer than the field's p75. Is the reproduction still good?
Choose an answer to see the explanation.
Question 7 of 7Yielding and ranking on the server bring the same tea list visits under the line. Why does yielding come first?
Choose an answer to see the explanation.
Key takeaways
- An audit checks every page on every device, the same way each time: field data, choose, lab, cause, and a ranked list.
- Start from field data: a p75 for each page and device, with notes that say where the time went.
- Choose by share of visits times how far past the line. Not by the complaint, the worst number or the busiest page.
- Match the lab to the field. DevTools picks a network from the p75 round trip and suggests a 4× CPU. Reproduce the problem, not the number.
- Read the cause in a trace: the LCP and INP breakdowns, and the insights that name files and attributes.
- Rank fixes by visits brought under the line per hour of work, and measure again after each one.
Remember the one-liner.
Field data says where, the lab says why, and the ranked list says what to do first.
Sources
The facts on this page come from these docs and source files:
- Web Vitals, web.dev.
- Optimize Largest Contentful Paint, web.dev.
- Debug performance in the field, web.dev.
- CrUX methodology: eligibility, Chrome for Developers.
- CrUX dimensions: form factor, Chrome for Developers.
- CrUX metrics: round trip time, Chrome for Developers.
- CrUX API, Chrome for Developers.
- web-vitals 6.2.3: the attribution build, Google Chrome.
- Optimize Interaction to Next Paint, web.dev.
- Performance panel: compare your experience to your users, Chrome DevTools docs.
- NetworkManager.ts: getRecommendedNetworkPreset(), devtools-frontend.
- CPUThrottlingSelector.ts: the recommended CPU setting, devtools-frontend.
- network_state_notifier.cc: RoundRtt(), Chromium 157.
- Performance Insights, Chrome for Developers.
- Browser-level image lazy loading, web.dev.
- Optimize long tasks: scheduler.yield(), web.dev.
- Optimize Cumulative Layout Shift, web.dev.
Coming next: Writing an audit report. You'll turn Ravi's ranked list into a report that engineers and managers both act on.