Debugging Web Performance / Module 09

Module 9: Capstone: A Debugging Method That Keeps the Site Fast

Debug a slow page you have never seen, from field data to field confirmation, then keep it fast with budgets, Lighthouse CI and field alerts.

On Saturday morning, a week before the sale, Leo forwarded a message from Ines. She had moved her shows to TinyTickets that summer, and Harbor Nights, three nights at the arena in August, was her first sale on the site.

“My page takes forever to open on my phone,” Ines wrote. “My fans say the same.”

“Is it her photos?” Leo asked.

“It could be anything,” Maya wrote back. “Nobody on our side has looked at that page yet. I’ll start with what the phones sent us.”

Maya, Leo and TinyTickets are invented, and so are the numbers in their story.

This module doesn’t teach any new part of the browser. It teaches the order in which to use the tools of Modules 1 to 8 on a page you’ve never seen, so that a week is enough. Then it sets up three things that keep a fixed page fast: a performance budget, Lighthouse CI on every change, and an alert on the field data.

After this module, you can:

  • debug a page you’ve never seen in eight steps, from field data to field confirmation, and name the module behind each step
  • choose which page, device and metric to work on first from your own field data
  • write a performance budget as Lighthouse CI assertions, and set its numbers outside the spread between runs
  • alert on real-user metrics per page and device, with a minimum number of lines and a window you can defend
  • say for each tool of the course whether its data is lab or field, what it costs, and what it can’t show

The method in eight steps

Every module of this course followed the same order, one browser mechanism at a time. Written out, the order is a method you can use on any slow page:

  1. Start from field data. Group your field lines by page and device type, and read each metric at the 75th percentile (Module 1).
  2. Pick the worst metric on the worst page. A metric rated poor comes before one that needs improvement. Among equals, take the page with the most loads, because it affects the most buyers.
  3. Reproduce it in the lab. Set the phone profile, the cache state and the interaction the field lines name. Stop when the lab shows the same symptom (Modules 1, 4 and 5).
  4. Read the trace. Follow the symptom down to a resource or a line of code (Modules 2 to 8). For a load, read the waterfall and LCP’s four parts; for a tap, the three parts of the interaction; for a long session, the heap.
  5. Name one cause. Write it as one sentence with a number in it: what happens, and how long it takes.
  6. Fix one thing. Make the smallest change that removes that cause.
  7. Confirm in the lab. Same setup, same number of runs, before and after. Check all three metrics, because a fix can move another one.
  8. Confirm in the field. Read the same group’s 75th percentile after the release, once it has enough lines. Then go back to step 2.

Figure 1 draws the steps as a loop. Steps 3 to 7 can run many times inside one week, but steps 1, 2 and 8 run on the field’s clock.

   field                       lab                          field
+------------------+   +--------------------------+   +--------------------+
| 1 field data     |   | 3 reproduce              |   | 8 confirm in the   |
|   by page and    |-->| 4 read the trace         |-->|   field: same      |
|   device, p75    |   | 5 name one cause         |   |   group, enough    |
| 2 worst metric,  |   | 6 fix one thing          |   |   lines            |
|   worst page     |   | 7 confirm in the lab  <--+   +--------------------+
+------------------+   +--------------------------+             |
         ^                      next cause: back to 4           |
         +------------------------------------------------------+
                         page still slow: back to 2

Figure 1: field data chooses the work and judges it; the lab explains it.

Why start in the field and not with a Lighthouse score? A common belief is that the score is the page’s speed. But it’s one lab run of a page load on an emulated phone. It has no INP, because nobody taps, and its numbers aren’t the ones your buyers get. web.dev’s own advice is to start with field data, debug in the lab, and confirm in the field again (tools to measure Core Web Vitals). Lab data still has a place before step 1: it’s the only data for a page nobody has visited yet.

Rule: Field data decides what to fix and whether the fix worked; lab data explains why.

Steps 5 and 6 carry most of the discipline. One cause and one change per round means every lab number before and after belongs to one change. So when a fix moves a number you didn’t expect, you know which change did it.

The method on Ines’s page

Ines’s page isn’t a show page from the template of Modules 3 to 7. It’s an organizer page, which Nina built that spring: the organizer writes a notice, uploads photos for a slideshow, and lists the lineup of every night. The page’s script fetches that content as JSON and draws it, so organizers can change their page without a deploy. Harbor Nights was the first organizer page with a long lineup.

The lab app is Module 8’s, with Ines’s page added as it was on that Saturday. The finished code for this module is in the course repository, folder module-09/.

Step 1: what the field lines say

vitals.js from Module 1 runs on the organizer pages too, so Maya’s endpoint had a week of lines from Ines’s page. She grouped them by page and device type, as Module 1’s p75.js does, and put the organizer page next to the show pages. Figure 2 is the phones’ part.

Phones, last 7 days, p75 Lines (LCP) LCP INP CLS
Harbor Nights (organizer page) 1,240 5.1 s, poor 280 ms, needs improvement 0.22, needs improvement
Show pages (Modules 3 to 7) 1,290 2.3 s, good 140 ms, good 0.000, good

Figure 2: on phones, Ines’s page is worse than the show pages in all three metrics, and poor in one.

The thresholds are web.dev’s, each at the 75th percentile of page loads. LCP is good up to 2.5 s and poor over 4 s. INP is good up to 200 ms and poor over 500 ms, and CLS good up to 0.1 and poor over 0.25 (LCP, INP, CLS, read 2026-11-18). On desktops, the same page had an LCP of 1.9 s, INP of 70 ms and CLS of 0.16.

The page had 610 INP lines, because only visits with a tap or a key press send one. CLS lines come only from Chromium browsers (Module 1).

CrUX had nothing for this URL. The page was two weeks old and had too few Chrome visits, and the origin’s data mixes every TinyTickets page. So for a new page, your own field data is the only field data.

Pause and predict. Figure 2 shows three problems. Which one does step 2 pick, and why that one?

Answer

LCP. It’s the only metric rated poor, and it counts on every visit, while INP counts only on visits with a tap. The page is also the worst page on phones: no other page has a metric rated poor in Maya’s lines. INP and CLS wait for the next rounds.

Step 2: the worst metric, and what its lines name

The attribution build of web-vitals (Module 1) sends more than the value. Each LCP line names the element and splits the time into Module 3’s four parts. A line sent by one of the lab runs below looks like this, cut to the fields that matter, with the lab’s usual port in the address:

{"page":"/harbor.html","device":"phone","name":"LCP","value":9384,"rating":"poor",
 "timeToFirstByte":564.5,"resourceLoadDelay":1541.4,"resourceLoadDuration":7265.5,
 "elementRenderDelay":12.6,"target":"#slides>img","url":"http://localhost:8080/harbor-1.jpg"}

In 1,190 of the 1,240 LCP lines from phones, the element was #slides>img, the first photo of the slideshow. At the 75th percentile, resource load delay was 1.2 s and resource load duration 3.0 s. (Percentiles of parts don’t add up to the percentile of the whole; they show where the time goes.) So the field already pointed at the photo, both at when it started and at how long it took.

Reproduce it in the lab

The page as it was that Saturday

The organizer’s content is a JSON file that the organizer edits: a notice, three photos and 60 acts for each of the three nights. In the lab it’s public/harbor.json, a long file you don’t change, so copy it from the course repository. Its shape is:

{
  "notice": "The presale is sold out. The general sale opens Saturday at 10:00.",
  "slides": [
    { "src": "/harbor-1.jpg", "alt": "The arena stage at night, lit in blue" },
    { "src": "/harbor-2.jpg", "alt": "The crowd in front of the main stage" },
    { "src": "/harbor-3.jpg", "alt": "The arena from the upper seats" }
  ],
  "nights": {
    "Friday": [{ "name": "Blue Tide", "time": "18:00", "stage": "Tent", "bio": "Quiet songs that end loud." }]
  }
}

Ines’s three photos are JPEG files of 1200 × 675 pixels, 383 to 411 KB each. Copy harbor-1.jpg, harbor-2.jpg and harbor-3.jpg from the course repository into public/, with the smaller versions next to them that Round 2 uses.

Create public/harbor.html, the page as the server sent it:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Harbor Nights - TinyTickets</title>
  <link rel="stylesheet" href="/styles.css">
  <link rel="stylesheet" href="/harbor.css">
  <script type="module" src="/assets/harbor.js"></script>
</head>
<body>
  <header>TinyTickets</header>
  <main>
    <p id="notice" hidden></p>
    <div id="slides"></div>
    <h1>Harbor Nights</h1>
    <p class="when">August 7, 8 and 9, doors open at 18:00. The arena.</p>
    <p>Three nights of music by the water, presented by Ines.</p>
    <p class="price">Tickets $45 a night</p>
    <a class="buy" href="/seats.html">Buy tickets</a>
    <h2>Lineup</h2>
    <div id="nights">
      <button type="button" aria-pressed="true">All nights</button>
      <button type="button" aria-pressed="false">Friday</button>
      <button type="button" aria-pressed="false">Saturday</button>
      <button type="button" aria-pressed="false">Sunday</button>
    </div>
    <ul id="lineup"></ul>
  </main>
</body>
</html>

Create public/harbor.css:

#notice { margin: 12px 0 0; padding: 8px 12px; background: #fff4e5; font-weight: 700; }
#slides { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scroll-snap-type: x mandatory; }
#slides img { flex: none; scroll-snap-align: start; }
h1 { margin: 16px 0 4px; font-size: 28px; line-height: 1.2; }
.when { margin: 0; font-weight: 700; }
.price { font-size: 20px; }
.buy {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  background: #e8590c;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
#nights button { padding: 8px 12px; font: inherit; }
#nights button[aria-pressed="true"] { background: #1d1d1f; color: #fff; }
#lineup { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 0; list-style: none; }
#lineup li { box-sizing: border-box; width: calc(50% - 4px); padding: 8px; background: #f2f2f7; }

Create src/harbor.js, the script as Nina wrote it:

import './vitals.js';
import './load-analytics.js';

const notice = document.getElementById('notice');
const slides = document.getElementById('slides');
const nights = document.getElementById('nights');
const lineup = document.getElementById('lineup');

function showNight(night) {
  for (const button of nights.children) button.setAttribute('aria-pressed', button.textContent === night);
  let left = null;
  for (const card of lineup.children) {
    card.hidden = night !== 'All nights' && card.dataset.night !== night;
    if (card.hidden) continue;
    // Two cards side by side get the height of the taller one, so the rows line up.
    card.style.height = 'auto';
    const height = card.offsetHeight;
    if (!left) {
      left = { card, height };
      continue;
    }
    const tallest = Math.max(left.height, height);
    left.card.style.height = card.style.height = `${tallest}px`;
    left = null;
  }
}

// The organizer's content comes from a file the organizer edits, so a change needs no deploy.
async function render() {
  const page = await (await fetch('/harbor.json')).json();
  if (page.notice) {
    notice.textContent = page.notice;
    notice.hidden = false;
  }
  slides.innerHTML = page.slides.map((slide) => `<img src="${slide.src}" alt="${slide.alt}">`).join('');
  lineup.innerHTML = Object.entries(page.nights)
    .flatMap(([night, acts]) => acts.map((act) =>
      `<li data-night="${night}"><strong>${act.name}</strong> ${act.time}, ${act.stage}<br>${act.bio}</li>`))
    .join('');
  showNight('All nights');
}

nights.addEventListener('click', (event) => {
  if (event.target.matches('button')) showNight(event.target.textContent);
});

render();

Add 'harbor' to the pages list in build.js, run npm start, and open http://localhost:8080/harbor.html.

Step 3: the phone profile, the cache and the tap

The laptop hides two of the three symptoms. Without throttling, three runs at 412 × 823 gave an LCP of 112 to 200 ms and an All nights tap of 16 to 24 ms. But CLS was 0.222, as on a phone, because a shift depends on the order in which things appear, not on the speed.

The runs behind this module used headless Chrome 157 on the 2019 laptop (Intel Core i7-9750H), driven through the DevTools Protocol. The phone profile was Module 1’s: 412 × 823 pixels, device pixel ratio 1, touch, Slow 4G and 6x CPU. The cache was off, because the field lines were navigate loads from buyers who had never opened the page (Module 4). Each version ran three times. Each run waited 12 seconds after the load event, then tapped Saturday, All nights and Sunday, 3.5 seconds apart, because the INP lines named #nights>button. Your numbers will differ.

On the sale-day page, three runs gave:

  • LCP 9,352 to 9,384 ms, on harbor-1.jpg: TTFB 564 ms, resource load delay 1,526 to 1,541 ms, load duration 7,249 to 7,266 ms, render delay 12 to 14 ms.
  • CLS 0.222 in every run, in two shifts at about 2.1 s and 2.7 s.
  • The All nights tap 256 to 272 ms, with 221 to 243 ms of processing. Saturday and Sunday took 72 to 104 ms.

The lab’s LCP is slower than the field’s 5.1 s, because Slow 4G is slower than most buyers’ networks. But the parts agree with the field on where the time goes. The lab’s 0.222 and 256 to 272 ms are close to the field’s 0.22 and 280 ms. So the symptom reproduces.

Read the trace, name the cause, fix one thing

Round 1: LCP

Step 4, read the trace. Figure 3 is one load, drawn from its Resource Timing entries and long tasks in the page-load timeline of Module 3, at 200 ms per character. The Network panel’s waterfall and the Main track show the same.

time (s)     0    1    2    3    4    5    6    7    8    9    10
             |    |    |    |    |    |    |    |    |    |    |
harbor.html  ===
styles.css      ===
harbor.css      ===
harbor.js       ===  + the shared chunk
harbor.json         ===
analytics.js        =====
harbor-1.jpg           =====================================
harbor-2.jpg           ===================================
harbor-3.jpg           =====================================
main thread            [r][a]
                ^ TTFB 0.56 s
                    ^ FCP 1.31 s
                       ^ shifts at 2.1 s and 2.7 s
                                                 LCP 9.37 s ^

r = render() draws the page, 175-200 ms; a = analytics.js runs, 206-219 ms

Figure 3: the photo waits for a script and a JSON file, then shares the network with two more photos.

Read it from the LCP mark backward, as Module 3 did:

  1. The photo’s request starts at 2.1 s, though the HTML arrived at 0.56 s. That gap is the resource load delay. The preload scanner (Module 3) can’t find harbor-1.jpg, because no HTML names it: the HTML names harbor.js, which fetches harbor.json, whose answer names the photo. That’s a chain of three requests, each a full round trip on Slow 4G.
  2. All three photos start in the same millisecond. harbor-2.jpg and harbor-3.jpg sit to the right of the first one in the slideshow, off the screen, but nothing tells the browser so. So they share the connection’s bandwidth with the photo the buyer sees, and each is 1200 pixels wide for a box 380 pixels wide.
  3. The two shifts come from the same chain. The notice appears above the photo when harbor.json arrives, and moves the title down 76 px. Then the photos’ sizes become known and push everything below them down by 213 px. web-vitals named #lineup as the largest shifted element.

Pause and predict. Two parts of LCP are large: the delay of 1.5 s and the duration of 7.3 s. Suppose you remove only the delay, so the photo starts with the CSS. By how much does LCP fall?

Answer

By about 4 s, not 1.5 s. The measured LCP fell from 9.4 s to 5.3 s (Round 1 below). The photo now has 1.5 s alone on the network before the other two photos start, so its download also got shorter, from 7.3 s to 4.7 s. A fix can move time between parts, and here it removed time from two of them.

Step 5, name one cause. Maya wrote it down: “The first photo is requested at 2.1 s, because only the JSON names it, and its 409 KB then share Slow 4G with two more photos.”

That’s two problems, and the method takes them one at a time. The first is the late start, which also causes both shifts.

Step 6, fix one thing. In production, the server writes the organizer page from the same JSON on every request, so it can write the top of the page itself. The lab’s HTML file stands in for that output. Replace the two empty elements at the top of <main> in public/harbor.html:

    <p id="notice">The presale is sold out. The general sale opens Saturday at 10:00.</p>
    <div id="slides">
      <img src="/harbor-1.jpg" width="1200" height="675" fetchpriority="high" alt="The arena stage at night, lit in blue">
    </div>

In src/harbor.js, delete the notice constant and the if (page.notice) block, and add only the other photos after the first one:

  // The notice and the first photo are in the HTML. The other photos follow it.
  slides.insertAdjacentHTML('beforeend', page.slides.slice(1)
    .map((slide) => `<img src="${slide.src}" alt="${slide.alt}">`).join(''));

The width and height give the photo its shape before any byte arrives, as Module 6 did for the show page.

Step 7, confirm in the lab. Three runs: LCP 5,300 to 5,340 ms. Resource load delay fell from about 1,530 ms to 58 to 68 ms, and load duration from about 7,260 ms to 4,666 to 4,689 ms. CLS fell from 0.222 to 0.000, because nothing appears above the photo any more and the photo’s box has its size from the start. FCP stayed at 1,312 to 1,320 ms, and the All nights tap at 248 to 264 ms.

LCP is still over 4 s in the lab, so the round goes back to step 4 with the second half of the cause.

Round 2: LCP again, now the bytes

Step 4 again. The first photo now starts at 0.62 s. But the other two start at about 2.1 s, when harbor.js adds them, and from then on all three share the network until 5.3 s. But the photo is still the 1200-pixel file, 409 KB, shown 380 CSS pixels wide.

Step 5. “The phone downloads a 409 KB photo, 1200 pixels wide, for a box 380 pixels wide, while two more photos of the same size share the network.”

Pause and predict. The cheapest change is loading="lazy" on the second and third photos. They’re off the screen, so they should wait until the buyer swipes. What happens to LCP?

Answer

Almost nothing: 5,260 to 5,280 ms, against 5,300 to 5,340 ms. Both lazy photos still started at about 2.1 s. They sit right next to the first photo in a row that scrolls sideways, close enough to the screen that Chrome loads them at once. loading="lazy" only says “not until it is near the screen”, and the browser decides what near means (Module 3).

Step 6. Send each phone the size it shows, in the format the show pages use since Module 3. The organizer upload now makes each photo at 400, 800 and 1200 pixels, in AVIF and JPEG; copy those files from the course repository. Replace the first photo in public/harbor.html with a <picture>:

      <picture>
        <source type="image/avif" sizes="calc(100vw - 32px)"
          srcset="/harbor-1-400.avif 400w, /harbor-1-800.avif 800w, /harbor-1.avif 1200w">
        <img src="/harbor-1.jpg" width="1200" height="675" fetchpriority="high" sizes="calc(100vw - 32px)"
          srcset="/harbor-1-400.jpg 400w, /harbor-1-800.jpg 800w, /harbor-1.jpg 1200w"
          alt="The arena stage at night, lit in blue">
      </picture>

In src/harbor.js, build the other photos the same way, and add slideHTML above render():

// A photo the buyer swipes to: the same sizes and formats as the first one, loaded when near the screen.
function slideHTML(slide) {
  const name = slide.src.slice(0, -'.jpg'.length);
  const set = (type) => `${name}-400.${type} 400w, ${name}-800.${type} 800w, ${name}.${type} 1200w`;
  return `<picture>
    <source type="image/avif" sizes="calc(100vw - 32px)" srcset="${set('avif')}">
    <img src="${slide.src}" width="1200" height="675" loading="lazy" sizes="calc(100vw - 32px)"
      srcset="${set('jpg')}" alt="${slide.alt}">
  </picture>`;
}
  slides.insertAdjacentHTML('beforeend', page.slides.slice(1).map(slideHTML).join(''));

In public/harbor.css, the slideshow’s children are now <picture> elements:

#slides picture { flex: none; width: 100%; scroll-snap-align: start; }

loading="lazy" stays on the later photos. It changed nothing for this slideshow of three. But in a longer slideshow, the photos far to the right would wait for a swipe.

Step 7. Three runs: LCP 1,344 to 1,364 ms, on harbor-1-400.avif, 12.8 KB. Load duration fell from about 4,670 ms to 699 to 704 ms. FCP stayed at 1,312 to 1,324 ms and CLS at 0.000. Figure 4 is the same timeline with only the photos’ rows changed.

time (s)     0    1    2    3
             |    |    |    |
harbor.html  ===
styles.css      ===
harbor.css      ===
harbor.js       ===  + the shared chunk
harbor-1-400    ====  .avif, 12.8 KB, in the HTML  NEW
harbor.json         ===
analytics.js        ====
harbor-2-400            ===  .avif, NEW
harbor-3-400            ===  .avif, NEW
main thread            [r][a]
                ^ TTFB 0.56 s
                    ^ FCP 1.31 s, LCP 1.34 s

r = render(), 167-171 ms; a = analytics.js runs, 208-214 ms

Figure 4: the photo starts with the CSS and is small enough to finish before the JSON arrives.

The phone profile has a device pixel ratio of 1, so it picks the 400-pixel file. But many phones have a higher ratio, and Module 3 tested 2 and 2.625. Three more runs at a ratio of 2.625 picked the 1200-pixel AVIF, 179 KB, and gave an LCP of 2,288 to 2,300 ms. The same runs with the JPEG srcset and no AVIF picked the 1200-pixel JPEG, 409 KB, and gave 5,200 to 5,256 ms, no better than Round 1. On this page, the srcset alone helps only the phones with a low ratio; the format does the rest.

The costs of Rounds 1 and 2:

  • The server writes part of the page. The notice and the first photo now come from the server, and the other photos from the script. Two code paths draw photos, and they must stay alike.
  • Six files per photo. The upload must make three sizes in two formats. That’s processing time and storage for every photo an organizer uploads, and an encoder in the upload code.
  • fetchpriority="high" on one photo only. Module 3 found that it helps when there’s a queue to jump. If you mark every photo, it means nothing.

Round 3: INP

Step 2 again. LCP is good in the lab, and the field will judge it after the release. So the next metric in Figure 2 is INP, 280 ms on phones. Its lines named the target #nights>button in 540 of 610 lines, with processing as the largest part, and the longest script was DIV#nights.onclick. A lab line from the sale-day runs had totalStyleAndLayoutDuration at 224 ms of a 272 ms interaction, a field that web-vitals takes from Module 5’s Long Animation Frames.

Step 3. The lab already reproduces it: the All nights tap took 248 to 296 ms after Round 2, and the other buttons 72 to 104 ms.

Step 4. A trace of the tap, recorded on the sale-day page with the same handler, shows one task of 272 ms, almost all of it inside showNight().

Pause and predict. The handler changes the hidden property and the height of 180 cards. Nothing in it looks heavy. Before you expand the task in the flame chart, where do you expect the 250 ms to go?

Answer

Into forced synchronous layout, Module 6’s layout thrashing. Inside the task, the Main track has 180 Layout events and 180 Recalculate style events, one pair for each card. For every card, the loop writes a style (hidden, then height = 'auto'), then reads offsetHeight. A read after a write makes the browser recalculate styles and lay out the lineup at once, so that it can answer.

In the traced run, 180 layouts took 195 ms and 180 style recalculations 36 ms. Each layout is about 1 ms, and there are 180 of them in one task. The other buttons show 60 cards, so they pay 60 layouts.

Lighthouse, which has the same Forced reflow insight as the Insights sidebar (Module 2), flagged the page’s script on the load too, where render() calls showNight() once.

Step 5. “The All nights tap forces 180 layouts in a row, 195 ms, because the loop reads each card’s height right after it writes one.”

Step 6. Module 6 gave two ways out: read all the heights first and then write them, or let CSS do the layout. Here CSS does all of it. In a grid, every item in a row stretches to the row’s height by default, which is what the loop computes by hand (MDN, align-items). In public/harbor.css, replace the two #lineup rules:

#lineup { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; list-style: none; }
#lineup li { padding: 8px; background: #f2f2f7; }

And in src/harbor.js, showNight() keeps only what it must do:

// The grid in harbor.css gives the two cards in a row the same height.
function showNight(night) {
  for (const button of nights.children) button.setAttribute('aria-pressed', button.textContent === night);
  for (const card of lineup.children) card.hidden = night !== 'All nights' && card.dataset.night !== night;
}

Step 7. Three runs: the All nights tap took 64 ms in each run, with 0 to 2 ms of processing and 48 to 55 ms of presentation delay. The other buttons took 32 to 48 ms. LCP stayed at 1,356 to 1,388 ms and CLS at 0.000. Figure 5 draws the tap before and after, in the main-thread timeline of Module 2 at 20 ms per character.

time (ms)     0         200       400
              |  |      |         |
before        [#############]          click 259 ms: 180 forced layouts (195 ms)
                                       and 180 style recalcs (36 ms); task 272 ms
after         [=]                      click 1.3 ms, then one layout of 29 ms
                                       in the frame; task 41 ms
                 ^ 50 ms, the long-task line

Figure 5: one layout in the frame replaces 180 layouts inside the click handler.

The presentation delay is now the largest part. It’s the one layout of all 180 cards that the frame must do anyway, plus paint. That layout ran once, in the frame, instead of 180 times inside the handler.

The fix also removed a long task at load. render() calls showNight('All nights') once, and its task fell from 167 to 200 ms to under 50 ms, so the load has only the analytics task left.

The costs of Round 3:

  • The grid sets the layout. Two columns are now in the CSS, but the old loop worked for any number of columns. If you want three columns on a wide screen, you’ll need a media query, which is still less code than the loop.
  • Equal height for the whole row. A one-line card in a row next to a four-line card gets a tall empty box. That’s what Nina’s loop did too.

If you can’t express a layout in CSS, the other way from Module 6 still works: read every height in one loop, then write every height in a second loop. That costs one forced layout instead of 180.

Step 8: confirm in the field

Figure 6 puts the three rounds side by side, each three runs on the phone profile.

Ines’s page LCP Largest LCP part CLS All nights tap
That Saturday 9,352–9,384 ms load duration, 7.25 s 0.222 256–272 ms
Round 1: the top of the page in the HTML 5,300–5,340 ms load duration, 4.67 s 0.000 248–264 ms
Tried: loading="lazy" on photos 2 and 3 5,260–5,280 ms load duration, 4.63 s 0.000 232–248 ms
Round 2: sizes and AVIF 1,344–1,364 ms load duration, 0.70 s 0.000 248–296 ms
Round 3: the grid 1,356–1,388 ms load duration, 0.70 s 0.000 64 ms

Figure 6: three causes, three changes, and each change moved the number it was meant for.

Maya shipped the three changes on Tuesday, four days before the sale. Ines’s page had more visits that week than ever, as fans checked the lineup. By Friday evening, the endpoint had 2,980 LCP lines from phones since the release, with a 75th percentile of 2.2 s. INP was 120 ms over 1,450 lines, and CLS was 0.000.

The 2.2 s is higher than the lab’s 1.4 s, as expected, because real phones have higher pixel ratios and pick larger files. But it’s under 2.5 s, and the lines that named the photo now had a resource load delay of 0.1 s at the 75th percentile.

CrUX wouldn’t show the change for weeks. Its 28-day window must first fill with loads after the release, and it lags about two days behind. So the full change appears around 30 days later, if the page has enough Chrome visits by then (CrUX API).

The sale opened on Saturday at 10:00. At 10:20, Leo forwarded a short message from Ines: “My fans are sending me their seat numbers. Nobody has written about the page.”

Keeping the page fast

Ines’s page was fixed, but the next change to the template could undo it, and nobody would know until the next message from an organizer. web.dev warns that “most performance improvements tend to regress within six months” (tools to measure Core Web Vitals).

Three checks keep a fixed page fixed, at three moments:

Check When it runs Data What it catches
Performance budget written once, changed on purpose none of its own nothing alone: it holds the limits the other two check
Lighthouse CI on every change, before release lab a change that makes a page load slower
Alert on field data every day, after release field what only buyers’ devices and taps show

Figure 7: a budget sets the limits; Lighthouse CI enforces them before a release, and the alert after it.

A performance budget

A performance budget is a set of limits on numbers that describe a page, agreed before the work, that no change may cross. web.dev’s article from 2018 names three kinds. Quantities are bytes and requests, milestone timings are metrics such as LCP, and rules are a score or a check that passes or fails (performance budgets 101). Its example numbers predate today’s tools, but its three kinds still fit.

For TinyTickets, Maya wrote one limit of each kind for the two page templates:

  • Timings: LCP 2.5 s and CLS 0.1, the field’s “good” lines. Lighthouse can’t measure INP, because it doesn’t tap. So Total Blocking Time (Module 1) is its stand-in, with a limit of 200 ms.
  • Quantities: at most 250 KB of images and 100 KB of scripts on a load, over the network. The fixed page loads 189 KB and 73 KB in Lighthouse, so a fourth large photo or a new library would cross them.
  • Rules: the LCP request discovery insight must pass: the LCP resource is in the HTML, not lazy, with fetchpriority="high". The forced reflow insight should pass, as a warning.

Lighthouse once read budgets from its own budget.json file. Lighthouse 12.0 removed that feature in 2024 (release notes). Lighthouse CI 0.16.1 still converts such a file into its own assertions, but it can’t mix them with other assertions. So the budget lives where Lighthouse CI reads it.

Lighthouse CI on every change

Lighthouse CI is a command-line tool from the Chrome team. It runs Lighthouse several times on a list of URLs, checks the results against limits, and stores the reports (getting started). Each limit is an assertion: an audit, a limit, and a level, where error fails the build and warn only prints.

The budget above, as lighthouserc.json in the lab’s folder:

{
  "ci": {
    "collect": {
      "startServerCommand": "node server.js",
      "startServerReadyPattern": "TinyTickets on",
      "url": ["http://localhost:8080/harbor.html", "http://localhost:8080/show.html"],
      "numberOfRuns": 5,
      "settings": { "onlyCategories": ["performance"] }
    },
    "assert": {
      "aggregationMethod": "median-run",
      "assertions": {
        "largest-contentful-paint": ["error", { "maxNumericValue": 2500 }],
        "cumulative-layout-shift": ["error", { "maxNumericValue": 0.1 }],
        "total-blocking-time": ["error", { "maxNumericValue": 200 }],
        "lcp-discovery-insight": ["error", { "minScore": 1 }],
        "forced-reflow-insight": ["warn", { "minScore": 1 }],
        "resource-summary:image:size": ["error", { "maxNumericValue": 250000 }],
        "resource-summary:script:size": ["error", { "maxNumericValue": 100000 }]
      }
    },
    "upload": { "target": "filesystem", "outputDir": "./lhci-reports" }
  }
}

Three settings matter more than they look:

  • numberOfRuns: 5. The default is 3. Lighthouse’s own guide says the median of 5 runs is about twice as stable as 1 run (variability).
  • aggregationMethod: "median-run". Every assertion reads one run: the one in the middle of the five, chosen by its FCP and Lighthouse’s time-to-interactive estimate (representative-runs.js in LHCI’s source). Without it, LHCI 0.16.1 uses optimistic for maximum limits, the best of the five runs, so a page passes if one lucky run passes (assertions.js in its source).
  • Sizes are in bytes. resource-summary counts what crossed the network, compressed. The old budget.json used kilobytes.

Build the pages, then run all three steps of LHCI (collect, assert, upload) with one command:

npm run build
npx @lhci/cli@0.16.1 autorun

LHCI 0.16.1 and Lighthouse 13.6.0 ask for Node.js 22.19 or later. On the 22.17 used here, npm printed EBADENGINE warnings and both ran. The runs behind this section didn’t use collect, because it opens a debugging port for Chrome. They ran Lighthouse 13.6.0 through its Node.js API on Chrome 157 over a pipe, in five fresh browsers per page, and saved the reports where lhci assert reads them. assert and upload ran as shown. About 8 seconds per run on this laptop; your numbers will differ.

On the sale-day version of Ines’s page, lhci assert printed, in part:

Checking assertions against 1 URL(s), 5 total run(s)

  ✘  cumulative-layout-shift failure for maxNumericValue assertion
        expected: <=0.1
           found: 0.2220162379106269

  ✘  largest-contentful-paint failure for maxNumericValue assertion
        expected: <=2500
           found: 6680.2864

  ✘  lcp-discovery-insight failure for minScore assertion
        expected: >=1
           found: 0

  ✘  resource-summary.image.size failure for maxNumericValue assertion
        expected: <=250000
           found: 1203303

  ⚠️  forced-reflow-insight warning for minScore assertion
        expected: >=1
           found: 0

Assertion failed. Exiting with status code 1.

On the fixed page and on the show page, it printed All results processed! and exited with 0. Figure 8 has the five runs of each.

Lighthouse 13.6.0, 5 runs Score LCP TBT CLS Images
Ines’s page, sale day 65–67 5,704–6,680 ms 96–114 ms 0.222 1,203 KB
Ines’s page, fixed 100 1,505–1,731 ms 44–54 ms 0.000 189 KB
Show page 98 2,102–2,119 ms 96–113 ms 0.000 55 KB

Figure 8: Lighthouse’s numbers are on its own scale, and even a page with no randomness moves between runs.

Lighthouse’s numbers aren’t the phone profile’s. By default it loads the page at full speed and simulates a phone from the result: 4x CPU, 150 ms round trips and about 1.6 Mbps. Its screen is 412 × 823 at a pixel ratio of 1.75, so it picked the 800-pixel photos. So set a budget from Lighthouse’s own runs, and keep the phone profile for debugging.

The change it caught

Three weeks later, Nina made the first photo of an organizer page come from slideHTML(), like the others, so that organizers could reorder their photos. The first photo now had loading="lazy" and no fetchpriority.

Pause and predict. The LCP limit is 2,500 ms, and the fixed page’s median was 1,729 ms. Does the LCP assertion catch Nina’s change?

Answer

No. Five runs gave 2,404, 2,412, 2,471, 2,489 and 2,567 ms. The run that median-run chose had 2,471 ms, under the limit, so the LCP assertion passed. One run in five was over it, so with a single run the gate would have failed this change about one time in five.

But the rule caught it. lcp-discovery-insight failed in all five runs, because the LCP image was lazy, and LHCI printed one failure and exited with status 1. A rule about the cause doesn’t move between runs, but a timing near its limit does.

Nina changed slideHTML() to give whichever photo comes first fetchpriority="high" and no loading="lazy", the markup of the fixed page, which passes.

What Lighthouse CI costs

  • Time and a steady machine. Five runs of two pages took about 80 seconds here. Lighthouse’s guide asks for at least 2 dedicated CPU cores, and says not to run several Lighthouse runs at once on one machine. A shared CI runner adds spread to every number.
  • Limits inside the spread fail at random. The sale-day page’s LCP was 5,704 ms in two runs and 6,680 ms in three. So leave room between the fixed page’s numbers and the limit, or the gate fails changes that did nothing.
  • Lab only, load only. It never taps, so INP regressions pass. TBT counts only after the first paint, and it misses a slow tap after the load.
  • Upgrades break assertions. Lighthouse 13 (October 2025) replaced its performance audits with insights and removed the old IDs, so an assertion on an ID such as render-blocking-resources stops matching. LHCI moved to Lighthouse 13.6.0 only with version 0.16.0 in November 2026 (releases). The third-party GitHub Action treosh/lighthouse-ci-action, at v12, still bundles LHCI 0.15 and Lighthouse 12.6.
  • Reports hold your pages. Each report has screenshots, a filmstrip and every request URL with its query string. Five runs of this small page wrote 12 MB. The temporary-public-storage upload target makes them public to anyone with the link, run by Eris Ventures LLC, not Google, and kept for 3 days to 5 weeks (services disclaimer). TinyTickets keeps them as files in CI.

collect runs Chrome on the CI machine, so it can test a private staging URL. Only the upload target decides where the reports go.

In a GitHub Actions workflow, the job is three lines after the setup. This excerpt follows LHCI’s getting-started guide and wasn’t run for this module:

# Excerpt from .github/workflows/lhci.yml
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: 22.x
      - run: npm ci
      - run: npm run build
      - run: npx @lhci/cli@0.16.1 autorun

Alerts on the field data

Lighthouse CI sees what a lab load shows. But some regressions only buyers see. A third party ships a slower script, a CDN setting changes, more buyers arrive on older phones, or the waiting page’s memory grows after 20 minutes (Module 8). For those, Maya runs a check over the field lines every morning.

Create alert.js in the lab’s folder:

// Reads the field data in vitals.ndjson and prints an alert for each page, device and metric
// that is over its limit in the last 7 days, or 20% worse than in the 7 days before.
// Run it once a day: node alert.js [--min=300]. It exits with status 1 when it prints an alert,
// so a scheduled job can send its output as a ticket or an email.
import { readFile } from 'node:fs/promises';

const DAY = 24 * 60 * 60 * 1000;
const WINDOW = 7 * DAY;
// Fewer lines than this give a 75th percentile too noisy to alert on.
const MIN = Number(process.argv.find((a) => a.startsWith('--min='))?.slice(6) ?? 300);
// The "good" limits of the Core Web Vitals. Memory and reloads have none, so only the rise counts.
const LIMITS = { LCP: 2500, INP: 200, CLS: 0.1 };
const RISE = 1.2;

const reports = (await readFile('vitals.ndjson', 'utf8'))
  .trim()
  .split('\n')
  .map((line) => JSON.parse(line));
// The last report for each metric id, as in p75.js. Memory samples have no id: each one counts.
const latest = [...new Map(reports.map((r, i) => [r.id ?? i, r])).values()];

const p75 = (values) => values.sort((a, b) => a - b)[Math.ceil(values.length * 0.75) - 1];
const now = Date.now();
function summarize(from, to) {
  const lines = latest.filter((r) => now - Date.parse(r.time) >= from && now - Date.parse(r.time) < to);
  const groups = new Map();
  for (const [key, group] of Map.groupBy(lines, (r) => `${r.page} ${r.device} ${r.name}`)) {
    groups.set(key, { value: p75(group.map((r) => r.value)), count: group.length });
    // The share of page loads that were reloads or restores (Module 8), counted on the LCP lines.
    if (key.endsWith(' LCP')) {
      const again = group.filter((r) => r.navigationType === 'reload' || r.navigationType === 'restore');
      groups.set(key.replace(/LCP$/, 'reloads'), { value: again.length / group.length, count: group.length });
    }
  }
  return groups;
}

const thisWeek = summarize(0, WINDOW);
const lastWeek = summarize(WINDOW, 2 * WINDOW);
const shown = (key, v) => (key.endsWith('CLS') ? v.toFixed(3) : key.endsWith('memory') ? `${(v / 1048576).toFixed(1)} MB`
  : key.endsWith('reloads') ? `${(v * 100).toFixed(1)}%` : `${Math.round(v)} ms`);

let alerts = 0;
for (const [key, { value, count }] of thisWeek) {
  if (count < MIN) continue;
  const limit = LIMITS[key.split(' ').at(-1)];
  const before = lastWeek.get(key);
  const reasons = [];
  if (limit !== undefined && value > limit) reasons.push(`over ${shown(key, limit)}`);
  // A rise from zero has no ratio: a CLS of 0 last week would make any shift an alert.
  if (before?.count >= MIN && before.value > 0 && value > before.value * RISE) reasons.push(`was ${shown(key, before.value)}`);
  if (reasons.length === 0) continue;
  alerts++;
  console.log(`ALERT ${key}: ${key.endsWith('reloads') ? 'share' : 'p75'} ${shown(key, value)} from ${count} lines, ${reasons.join(', ')}`);
}
console.log(`${alerts} alerts; groups with fewer than ${MIN} lines were skipped`);
process.exitCode = alerts > 0 ? 1 : 0;

Two rules make an alert, as the comments say: a Core Web Vital over its “good” line, or any number 20% worse than the week before. The second rule is the only one for the waiting page’s memory and for its share of reloads and restores, which have no published limits.

The lab runs of the sale-day page left three loads’ lines in vitals.ndjson. If you run node alert.js --min=3 on them, it prints:

ALERT /harbor.html phone LCP: p75 9384 ms from 3 lines, over 2500 ms
ALERT /harbor.html phone INP: p75 272 ms from 3 lines, over 200 ms
ALERT /harbor.html phone CLS: p75 0.222 from 3 lines, over 0.100
3 alerts; groups with fewer than 3 lines were skipped

With the default of 300, the same file prints 0 alerts, because three lines are far too few. On the fixed page’s lines, it printed no alert either way.

How many lines make a 75th percentile

The minimum count decides whether the alert can be trusted. The research for this module drew page loads from an assumed LCP distribution: log-normal, with a median of 1,800 ms and a true 75th percentile of 2,698 ms. It computed the 75th percentile of each sample size 2,000 times. Figure 9 is the range that held 95% of the results.

Lines in the window 95% of the computed p75 values Spread
50 2,158–3,350 ms ±22%
100 2,279–3,123 ms ±16%
300 2,467–2,964 ms ±9%
1,000 2,560–2,835 ms ±5%
3,000 2,621–2,779 ms ±3%

Figure 9: with 50 lines, a page whose true p75 is 2.7 s can show anything from 2.2 s to 3.4 s.

The distribution is assumed, not real data, and a heavier tail needs more lines. But the shape holds in general: four times the lines halve the spread. So the 20% rise rule needs a few hundred lines in each week before it means anything, and Ines’s 1,240 LCP lines a week were enough. Her 610 INP lines were enough for the limit, with less room for the rise rule.

Pause and predict. Suppose a page sends 120 INP lines from phones a week, with a 75th percentile of 260 ms. What does alert.js print for it, and what could you change if that page matters?

Answer

Nothing: 120 is under 300, so the group is skipped. With about 100 lines, Figure 9’s spread is about ±16%, so the true value could be anywhere from about 220 to 300 ms. You can give small pages a longer window, such as 28 days, which detects later. You can lower MIN for them and accept more false alerts. Or you can check that page in the lab on every change instead.

Judging an alert

Google’s SRE workbook judges an alert by four numbers (alerting on SLOs). Precision is the share of alerts that were real problems. Recall is the share of real problems that caused an alert. Detection time is how long a problem runs before the alert, and reset time is how long the alert keeps firing after the fix.

Each setting in alert.js trades one for another:

  • A higher MIN raises precision, and small pages never alert at all, so recall falls for them.
  • A longer window raises precision and lengthens detection time and reset time. Seven days hold each day of the week once, so both windows have the same mix of weekdays. A one-day window would detect sooner, but with fewer lines and a wider spread.
  • The 20% rise catches a change below the limit, such as memory, at the price of more alerts near the line.

A slow page is rarely an emergency at 3:00. That’s why TinyTickets sends the output as a ticket for the next morning, not as an alarm on someone’s phone. Before a big sale, Maya runs it by hand with a one-day window.

The alert has costs of its own. Every line is a beacon from a buyer’s phone, and storage on the server. The lines hold page paths and CSS selectors, which the privacy page must cover (Module 1). CLS lines come only from Chromium browsers, and the memory lines only from Chromium on the isolated waiting page (Module 8), so those alerts speak for Chromium users only. web-vitals reports LCP and INP from Firefox and Safari as well (README).

What changed recently

  • 2024-04, Lighthouse 12.0: budget.json and the budget audits were removed (release notes).
  • 2025-10, Lighthouse 13: insights replaced the performance audits in reports and JSON; scoring didn’t change; Chrome 143 ships it in DevTools (Lighthouse 13).
  • 2025-11: the CrUX Dashboard stopped; CrUX Vis replaced it (CrUX Dashboard deprecation).
  • 2026-07, web-vitals 6.0: soft navigations, where the browser supports them; Chromium 151 is the first (changelog).
  • 2026-09 and 10: CrUX added experimental soft-navigation versions of LCP, INP and CLS, and says they will be included from May 2027 (CrUX release notes).
  • 2026-11, LHCI 0.16.0: Lighthouse 13.6.0 and Node.js 22 as the minimum (releases).

What we chose not to do, and why

Each item below cost more than it would have saved for TinyTickets this summer. But each has a sign that would change the answer.

  • No hosted monitoring service. It adds dashboards and storage, but costs money and sends buyers’ data to a third party (Module 1). The sign: more lines than one file and one script can handle.
  • No LHCI server. It keeps every report and draws trends, but it’s one more server to run and secure, with an admin token that can delete every report. The sign: many changes a day, and questions such as “when did TBT start rising?”.
  • No assertion on the Lighthouse score. In Lighthouse 13.6.0 the score mixes five metrics (default-config.js in its source). The weights are 10 for FCP, 25 for LCP, 30 for TBT, 25 for CLS and 10 for Speed Index, Lighthouse’s measure of how fast the visible part of the page fills in. A lower score doesn’t name a cause, but the metrics and insights do.
  • No separate bundle-size tool. size-limit checks each file compressed and fails CI. Vite’s own limit checks uncompressed size, and both Vite’s and webpack’s limits only warn by default. The resource-summary assertions already cover the bytes per page.
  • The seat map isn’t in Lighthouse CI yet. Its first frame of about 1.9 s (Module 7) would fail the TBT limit on every change, and a gate that always fails is soon ignored. The first practice below is that work.
  • Known costs that stay. The analytics task, about 210 ms after load on every page (Module 7), and the waiting page’s table, rebuilt every 5 seconds (Module 8). The field lines show neither as a problem today, and the alert watches both pages.
  • No memlab run on every change. A leak like Module 8’s needs a scripted session of many polls, minutes per change. The sign: a second leak that ships.
  • No server-side work. The lab’s TTFB was 0.56 s in every run; the field’s TTFB is a question about the servers, which the Performance and Cost course covers.

Practice: two pages to debug alone

Each practice gives you what Maya had: field lines, lab facts and the code in the course repository. Write your answer as the eight steps before you open the hints.

Practice 1: the seat map’s first frame

After the Harbor Nights sale, the seat map is the slowest page on phones. Its field lines from the last 7 days (invented, like every story number):

Seat map, phones, p75 Lines Value
LCP 2,140 3.4 s, needs improvement
INP 1,860 150 ms, good
CLS 1,610 0.000, good

In 1,980 of the LCP lines, the element is the stadium picture at the top of the page. Element render delay is the largest of the four parts, 2.0 s at the 75th percentile. From Modules 6 to 8 you know the lab facts. The first load is one long frame of about 1.9 s: about 0.65 s of script, and about 1.1 s of style, layout and paint for 60,000 seat elements.

What is the cause of the LCP, what would you change first, what does it cost, and how would you confirm it?

Hint 1

Element render delay is the time between the picture’s last byte and its paint (Module 3). What must finish before the browser can paint any frame?

Hint 2

Module 6 measured three ways to draw the map. Which one changed the length of the first frame, and what did it cost?

A strong answer
  1. Field: the seat map is the worst page left on phones, and LCP is its worst metric.
  2. Worst metric: the lines name the picture and its render delay, not its download.
  3. Reproduce: the phone profile with the cache off, then LCP’s four parts.
  4. Trace: the picture’s bytes arrive early, but the main thread is inside one frame of about 1.9 s that builds and lays out the map. The picture is painted at the end of that frame.
  5. Cause: “The picture’s paint waits for a frame of about 1.9 s that builds, styles and lays out 60,000 seat elements.”
  6. Fix: drawing the map on one <canvas>, as Module 6 measured, cut the long frame from about 1.92 s to 236–249 ms and LCP from about 3.66 s to 1.55–1.58 s. Its cost: the seats are no longer elements, so buyers with screen readers and keyboards need another way to pick seats, and hit testing becomes your code. A smaller step is to yield before building the map (Module 5), so the picture paints first; the map then appears later, and early taps wait. No Core Web Vital measures “the map is ready”, so first add a performance.measure() for it (Module 2) to the field lines.
  7. Lab: three runs before and after, with all three metrics and the time to the map.
  8. Field: the same group after the release; CrUX about 30 days later. Then add the seat map to lighthouserc.json.

A weaker answer reaches for content-visibility: auto. Module 6 measured it on this map: most rows are within the distance Chrome renders, so the first load barely changed and scrolling got new long tasks.

Practice 2: a gate that fails at random

Omar’s other project runs Lighthouse CI with one run per change, the default of the third-party GitHub Action. He copied a TBT limit of 50 ms, because Ines’s fixed page had measured 44 to 54 ms. In one week, the gate failed 3 of 14 changes. But none of the three touched a script.

These are real numbers from five runs each, on the laptop behind this module:

Lighthouse 13.6.0 TBT in five runs
Ines’s fixed page 54, 47, 43.5, 44.5, 46 ms
Nina’s lazy-photo change 53.5, 53.5, 44, 48.5, 51.5 ms

Are the three changes bad, or is the gate? What would you change, and what does that cost?

Hint 1

With one run per change, how often would the fixed page itself fail a limit of 50 ms?

Hint 2

What does median-run read, and where would you put a limit so that the page’s own spread can’t cross it?

A strong answer

The gate is bad. The limit sits inside the page’s own spread. One run in five of the unchanged page was over 50 ms, so a single-run gate fails about one change in five for nothing. That matches 3 in 14. Nina’s change doesn’t touch the main thread; its runs only landed on the high side more often.

So change three things. Run five times and assert on the median run: with median-run, both pages passed a 50 ms limit in these runs. Put the limit well outside the spread, such as 200 ms, where Lighthouse’s own TBT scoring for phones starts to fall below 90 (p10 of 200 ms in its source). And check that the CI machine has dedicated cores and runs one Lighthouse at a time.

The costs: five runs take five times as long, and a looser limit catches only large regressions. The rest is for rules that don’t vary, such as the insights, and for the field INP alert, which sees real taps.

Get feedback on your answer

Copy this prompt into an AI assistant, with your answer at the end:

I am learning to debug web performance with this method:
1. Start from field data by page and device, at the 75th percentile.
2. Pick the worst metric on the worst page.
3. Reproduce it in the lab (CPU and network throttling, cache state).
4. Read the trace (waterfall, LCP parts, INP parts, main-thread tasks).
5. Name one cause in one sentence with a number.
6. Fix one thing.
7. Confirm in the lab with the same setup, before and after.
8. Confirm in the field with enough samples.

Below are a practice problem and my answer. Check my answer against the
eight steps. For each step, say whether I did it, and what is missing.
Point out any conclusion I drew from a single lab run, any fix without a
cost, and any claim about a browser that needs a source. Do not rewrite
the answer for me.

Problem:
[paste the practice problem]

My answer:
[paste your answer]

Treat the reply as one reviewer’s opinion. It can’t run your page, so check every number it gives you with a run of your own.

The toolbox

Figure 10 lists every tool this course used or named, with the same columns for each. “Lab” means a page loaded by a tool; “field” means data from real visitors.

Tool Module Lab or field Free or paid What it shows Its limit
DevTools Performance panel 2–7 Lab; its field data section reads CrUX Free, in Chrome Traces, flame chart, Insights, live LCP, CLS and INP, Layout shifts track One machine, one run; you set throttling; Chromium only
DevTools Network, Coverage, Application 3, 4, 7 Lab Free Waterfall and priorities, unused bytes, back/forward cache tester One load at a time; the cache tester visits a fixed page, not your next one
DevTools Memory panel, Performance monitor 8 Lab Free Heap snapshots, retainers, detached elements, counters over time A snapshot forces a garbage collection and takes seconds
Lighthouse 13.6.0 1, 9 Lab Free, open source Score, metrics, insights, resource sizes Load only, no INP; simulated phone; numbers vary between runs
Lighthouse CI 0.16.1 9 Lab, in CI Free; the optional public storage is run by a third party Assertions on metrics, insights and bytes; reports Lab variance; asks for Node.js 22.19; public storage is public
web-vitals 6.2.3 1, 5, 9 Field, your visitors Free, open source LCP, INP, CLS with attribution, per page view You run the endpoint and storage; CLS from Chromium only
PageSpeed Insights 1 Field (CrUX, 28 days) and one lab run Free Pass or fail at p75, a Lighthouse report Public URLs only; field data only for pages in CrUX
CrUX Vis 1 Field (CrUX) Free Weekly p75 history, 40 points, by device Nothing for sites not in CrUX; Chrome users only
CrUX API 1 Field (CrUX) Free, with a Google Cloud key p75 and histograms as JSON, history by week 28-day window, about 2 days late; no iOS, Edge or WebView
WebPageTest 3 Lab, real devices and locations Free plan of 150 runs a month; paid plans Waterfall, filmstrip, video, repeat view Free tests are not private; public URLs only
DebugBear free speed test 3 Lab, plus CrUX Free test; more with an account Lighthouse report, waterfall, LCP breakdown Two locations without an account; public URLs only
Request Map Generator 3 Lab, one load Free Every request as a node, grouped by domain Shows who the page calls, not when
Firefox Profiler 2 Lab Free, open source Firefox profiles, shared by link Anyone with the link can read an upload; no Chrome Insights
trace.cafe 2 Lab Free A Chrome trace shared by URL A third-party site; links expire after a year
Safari Web Inspector 2, 8 Lab Free, in Safari Timelines, frames, memory, JavaScript allocations Needs a Mac; no CLS
REDbot 4 One request Free, open source How caches will treat a response’s headers No browser cache; the public site logs requests
CLS Debugger (webvitals.dev) 6 Lab, plus CrUX Free Shifted regions and elements on load Load only; reports public for 14 days
Layout Shift GIF Generator 6 Lab, load only Free An animated GIF of what moved Shows what moved, not why
Bundlephobia 7 Neither: package size Free Minified and gzip size of a package Not your bundle after tree shaking
pkg-size.dev 7 Neither: install size Free Install size and dependency tree, in your browser Install size is not what reaches buyers
esbuild’s Bundle Size Analyzer 7 Neither: your build Free Bytes per input file of your bundles Bytes, not time
memlab 2.0.6 8 Lab Free, open source (MIT) Leaked objects across three snapshots, with retainer paths Finds only what your scenario makes happen

Figure 10: field tools choose the work, lab tools explain it, and only your own field data covers every browser and every page.

Pause and predict. Which tools in Figure 10 could have shown the slow All nights tap on Ines’s page before any buyer tapped it?

Answer

Only lab tools that let you tap: the DevTools Performance panel, with a trace or live metrics, and in their own browsers the Firefox Profiler and Safari’s timelines. Lighthouse and Lighthouse CI never tap, but their forced reflow insight flagged the same code on the load, where render() runs it once. The field tools see the tap only after buyers make it.

The course doesn’t rank these tools. Facts such as free plans and limits were checked on 2026-11-18 and they change, so check them before you rely on one. Never paste a private or internal URL into a public tool (Module 1).

Course cheat sheet

Debugging web performance
  1. Field first: your own lines by page and device, p75; CrUX if public
  2. Worst metric on the worst page: poor before needs improvement
  3. Reproduce: phone profile, cache state, the tap the lines name
  4. Read the trace: LCP's 4 parts, INP's 3 parts, tasks, heap
  5. One cause, one sentence, one number
  6. One fix, with its cost; 7. lab before and after, all 3 metrics
  8. Field again, with enough lines; CrUX takes about 30 days
  Keep it: budget in lighthouserc.json, 5 runs, median-run, rules
  Alert daily on p75 per page and device, at least 300 lines

Figure 11 is the whole course in one picture: the method, each step labelled with the modules that taught its tools.

 1 field data by page and device, p75 ........... Module 1
 2 worst metric, worst page ..................... Module 1
 3 reproduce: throttling, cache, the tap ........ Modules 1, 4, 5
 4 read the trace
     load: waterfall, LCP parts, priorities ..... Modules 2, 3
     second visit: HTTP cache, bfcache ........... Module 4
     tap: INP parts, long animation frames ...... Modules 2, 5
     rendering: style, layout, paint, shifts .... Module 6
     scripts: parse, compile, third parties ..... Module 7
     long sessions: heap, retainers ............. Module 8
 5 name one cause; 6 fix one thing ............... Modules 3 to 8
 7 confirm in the lab, same setup ................ Modules 1, 2
 8 confirm in the field, enough lines ............ Modules 1, 9
   keep it: budget, Lighthouse CI, alerts ........ Module 9

Figure 11: one loop from the field to the field; every module taught the tools for one step of it.

Sources

What happened to TinyTickets after this sale is on the story page, where each new part appears with its course.