completefrontend
Open lab My progress
THE WEB PERFORMANCE FIELD GUIDE

Performance for designers and product managers

Design and product choices set a page's speed before code. Price hero videos, carousels and fonts, write speed into specs, and try designs on slow phones.

By the end, you can
  • 01
    Price a design's piecesSay what a hero film, a carousel and two web fonts cost a visitor's phone, in time and in data, from real loads.
  • 02
    Write speed into a specWrite a speed line with a moment, a number, a device and a tool, and turn it into a check that passes or fails.
  • 03
    Try designs on a slow phoneLoad a quick prototype with DevTools' throttling or on a real phone, and show the frames instead of adjectives.
  • 04
    Trade instead of saying noWeigh speed, looks and the cost to build, and agree a version that keeps the idea and meets the line.

A new home page that looks finished in the mock-up

Spring is coming to the Leaf and Kettle. Meera plans what goes on each page. In lesson 40.3, she made the home photo small and fast. Now she has drawn a new home page for spring. It keeps her photo and adds three pieces:

  • a short film of tea brewing at the top, which plays by itself;
  • a carousel: the green tea photo and two more teas, turning every 3 seconds;
  • two web fonts: Caveat, the shop's handwriting, for the heading, and Lora for the text.

The owner loves it. She's the shop's product owner: she decides what gets built, and when. She writes one line in the plan: "Done when it's live by Friday."

Ravi asks one question: "What will Asha see, and when?" Meera's mock-up can't tell him. A mock-up is a picture of a page, drawn in a design tool. It has no loading time. Every piece is simply there, all at once.

So Ravi builds a prototype: a quick, real page with Meera's pieces, made from today's home page. It has none of the shop's other code. He loads it beside today's page on Asha's phone in the lab:

Today's page and Meera's design on Asha's phonePop out in the code editor (opens in a new tab)JavaScript
// Asha's phone in the lab, in ms after she opened the page (the middle of 5 loads)const today = { photo: 1264, complete: 1264, bytes: 12468 };const meera = { photo: 1528, complete: 2852, bytes: 335194 }; console.log(`The photo: ${today.photo} ms today, ${meera.photo} ms in Meera's design`);console.log(`Complete: ${today.complete} ms today, ${meera.complete} ms in Meera's design`);console.log(`Data: ${Math.round(meera.bytes / today.bytes)} times as much`);
  • Line 1 is a comment. A millisecond (ms) is a thousandth of a second. Each page was loaded 5 times. These numbers come from the load in the middle.
  • Lines 2 and 3 hold the recorded numbers. photo is when the green tea photo appeared. bytes is how much data the phone downloaded.
  • complete is when the first screen was complete. The first screen is what Asha sees before she scrolls. It's complete when the photo, a picture in the film's box and the words in their own fonts are all there.
  • Lines 5 to 7 print The photo: 1264 ms today, 1528 ms in Meera's design, Complete: 1264 ms today, 2852 ms in Meera's design and Data: 27 times as much.

The photo came only a little later. But the first screen took more than twice as long to be complete. And Asha downloaded far more data. Here is what her phone showed:

Asha's phone at 1.0 s, 1.5 s, 2.0 s, 2.5 s, 3.0 s. Today's home page: 1.0 s, a blank screen; 1.5 s, the green tea photo and the heading in the phone's own font; 2.0 s, the green tea photo and the heading in the phone's own font; 2.5 s, the green tea photo and the heading in the phone's own font; 3.0 s, the green tea photo and the heading in the phone's own font. Meera's design: 1.0 s, a blank screen; 1.5 s, an empty box for the film, the photo still coming in and the heading in a stand-in font; 2.0 s, the film playing, the green tea photo and the heading in a stand-in font; 2.5 s, the film playing, the green tea photo and the heading in a stand-in font; 3.0 s, the film playing, the green tea photo and the heading in Caveat.1.0 s1.5 s2.0 s2.5 s3.0 sToday'shome pageblankAsha's phone at 1.5 s: the green tea photo and the heading in the phone's own fontcompleteAsha's phone at 2.0 s: the green tea photo and the heading in the phone's own fontcompleteAsha's phone at 2.5 s: the green tea photo and the heading in the phone's own fontcompleteAsha's phone at 3.0 s: the green tea photo and the heading in the phone's own fontcompleteMeera'sdesignblankAsha's phone at 1.5 s: an empty box for the film, the photo still coming in and the heading in a stand-in fontempty film boxAsha's phone at 2.0 s: the film playing, the green tea photo and the heading in a stand-in fontstand-in fontAsha's phone at 2.5 s: the film playing, the green tea photo and the heading in a stand-in fontstand-in fontAsha's phone at 3.0 s: the film playing, the green tea photo and the heading in Caveatcomplete
Asha's phone at the same five moments. Today's page is complete at 1.3 s and then stays still. Meera's design keeps changing until 2.9 s: first the film's box is empty, then the heading waits for its font.

Today's page is done at 1.3 s. Meera's design is still changing at 2.5 s. Nobody has written a line of the shop's real code yet. Why it matters: the design alone set these numbers, before any developer touched it.

Real-life analogyA recipe sets dinner time

A recipe for slow-roast lamb says three hours in the oven. The best cook in town can't make it ready in one. Dinner time was set when someone chose the recipe, long before the oven went on.

In real life: The recipe someone picks
In a web page: The design Meera draws and the owner approves
In real life: The cook's skill
In a web page: How well Ravi and Ben build it
In real life: Three hours in the oven
In a web page: The bytes and waits each piece brings
In real life: Reading the recipe before you shop
In a web page: Loading a prototype before you build
The main idea

Every piece of a design has a price, paid by the visitor's phone in time and data. Designers and product managers set that price when they choose the pieces. So speed belongs in the design and the spec, tried on a slow phone, and traded like any other cost. Code can make a design cheaper. It can't make a heavy design free.

The rest of this lesson takes one question at a time:

  • What does each piece cost? Carousels, hero videos and fonts.
  • How do you write speed into the plan? Performance in product specs.
  • Why did it look fine on Meera's laptop? Prototyping on slow devices.
  • How do you choose without a fight? Talking about the choices.

How the course recorded it

  • The pages: today's home page, and today's page with every mix of Meera's three pieces. That's eight pages, plus the design the team agrees at the end.
  • Asha's phone: Chrome 157 with a phone's screen, DevTools' Slow 4G network and a CPU 4 times slower, as in earlier lessons.
  • Meera's laptop: the same Chrome on the course's laptop, in a window the size of Asha's phone, with nothing slowed.
  • Five loads each, taking turns. The lesson quotes the middle one, by when its first screen was complete.

What a film, a carousel and two fonts cost Asha

Which piece costs what? Ravi adds them to today's page one at a time, and loads each page on Asha's phone.

One piece at a timePop out in the code editor (opens in a new tab)JavaScript
// Today's page with one piece added, on Asha's phone (the middle of 5 loads)const today = { complete: 1264, kB: 12 };const added = {  film: { complete: 1469, kB: 170 },  carousel: { complete: 1460, kB: 81 },  fonts: { complete: 2376, kB: 109 },}; for (const [piece, page] of Object.entries(added)) {  console.log(`${piece}: +${page.kB - today.kB} kB, complete ${page.complete - today.complete} ms later`);}
  • Line 1 is a comment. Line 2 holds today's page. A kilobyte (kB) is a thousand bytes.
  • Lines 4 to 6 hold today's page with one piece added, each from its own middle load.
  • Line 9 goes through the pieces. Line 10 prints the kB each one added, and how much later the first screen was complete.
  • It prints film: +158 kB, complete 205 ms later, carousel: +69 kB, complete 196 ms later and fonts: +97 kB, complete 1112 ms later.

Each piece costs something different. Here is what each one did to Asha's screen, in one load of Meera's whole design:

Three moments of one load of Meera's design on Asha's phone. The film, at 1.5 s: an empty box for the film, the photo still coming in and the heading in a stand-in font. The fonts, at 2.5 s: the film playing, the green tea photo and the heading in a stand-in font. The carousel, at 6.0 s: the film playing, the mint tea photo where the green tea was and the heading in Caveat.The film, 1.5 sAsha's phone at 1.5 s: an empty box for the film, the photo still coming in and the heading in a stand-in fontits box is still emptyThe fonts, 2.5 sAsha's phone at 2.5 s: the film playing, the green tea photo and the heading in a stand-in fontthe heading is ina stand-in fontThe carousel, 6.0 sAsha's phone at 6.0 s: the film playing, the mint tea photo where the green tea was and the heading in Caveatmint tea has takenthe green tea's place
One load of Meera's design. At 1.5 s the film's box is empty. At 2.5 s the heading still waits for Caveat. By 6.0 s the carousel has turned by itself: it started to move at 4.9 s.

The film at the top

A hero video is a big film at the top of a page, often playing by itself. Meera's film is short: 8 seconds, 157 kB. That's more than 12 times today's whole page. The phone downloaded all of it. A film that plays by itself fetches the whole file, as lesson 19.1 showed.

Until the film's first frame arrives, its box stays empty. With the film alone, that took until 1,469 ms. In Meera's design, it took until 1,910 ms. web.dev's LCP guide says a video is counted from "the poster image load time or first frame presentation time", whichever is earlier. A poster is a still picture the page shows in the film's box until it plays.

Why it matters: a film that plays by itself is the heaviest piece on this page, even though it's short.

The carousel that turns by itself

A carousel shows several slides in one place, one at a time. Ravi builds Meera's with Swiper, the same library as Ben's carousel in lesson 39.1. Its script is 40 kB over the network, and 154 kB once unpacked. The two extra photos add a little more.

The photo itself came only 196 ms later. The first slide is the same <img> tag, in the page's HTML, so the browser finds it early. web.dev's carousel guide says a well-built carousel "should have very minimal or no impact on performance". The trouble is what carousels carry, and what they do.

Look at the third frame again. At 4.9 s, the carousel turned by itself. The green tea photo, the one Meera made fast, slid away. web.dev says "it's rare that autoplay is a good choice". People often take moving slides for ads, and ignore them. It also warns that carousels "are often used to placate multiple departments and avoid making decisions about business priorities". In plain words: when every team wants the top spot, a carousel lets nobody choose.

Why it matters: a carousel's cost isn't only bytes. It decides what Asha sees, and when it leaves.

Two web fonts

A web font is a font file the page downloads. Lesson 20.1 showed how font-display: swap works. The words appear at once in a stand-in font, one the phone already has. When the file arrives, they change to the real font. Meera's two files are 75 kB of Caveat and 21 kB of Lora.

With the fonts alone, the photo came on time. But the words were in their own fonts only at 2,376 ms. That's 1,112 ms after today's page was complete. In lesson 20.4, Meera kept Caveat for a heading and gave the text the phone's own font. web.dev's font guide puts it plainly: "The fastest font to deliver is a font that isn't requested in the first place."

Why it matters: fonts change how the words look after Asha has started to read them.

All three share one line

Each piece alone kept the first screen complete within 2.4 seconds. All three together took 2,852 ms. Why more than each one alone? Asha's phone has one slow network line. Every file shares it.

Real-life analogyThree orders and one cook

A café has one cook. One order alone comes out quickly. Three orders at once share the same cook, so each one comes out later. Your table waits for the last dish.

In real life: The café's one cook
In a web page: Asha's one slow network line
In real life: Each order
In a web page: Each piece's files: the film, the script, the fonts
In real life: The last dish to reach the table
In a web page: The last part of the first screen
In real life: Ordering fewer dishes at once
In a web page: Dropping a piece, or making it wait until it's needed

Try it yourself. Turn each piece on or off, and see what Asha's phone showed at 2.5 seconds:

Playground: Meera's pieces, one at a time
Asha's phone at 2.5 s
Asha's phone at 2.5 s: the film playing, the green tea photo and the heading in a stand-in font
the film playing, the green tea photo and the heading in a stand-in font
  1. The product photo showed at1,528 ms
  2. The first screen was complete at2,852 ms
  3. Data Asha's phone downloaded335 kB
  4. Within 2.5 s?no
Try it yourself
Today's page with the film and the carousel and the two fonts

Turn each piece on or off. The frame is what Asha's phone showed at 2.5 s. The first screen is complete when the photo, a picture in the film's box and the words in their own fonts are all there.

Every mix of the three pieces, each loaded 5 times on Asha's phone in the lab: a phone's screen, DevTools' Slow 4G and a CPU 4 times slower. The numbers come from the middle load.

A speed line in the product spec

Back to the owner's line: "Done when it's live by Friday." It sets a date. It says nothing about speed. So any speed at all would pass.

A product spec is the document that says what to build. Its acceptance criteria are the lines that say when the work is done. Each one should be a check that passes or fails.

Lara Callender Hogan managed the performance team at Etsy. Her book Designing for Performance says what every speed goal needs. It names "the specific number to beat" and "the tool you'll use to measure it". It also gives "any details of what or whom you're measuring". So a speed line has four parts:

  • A moment Asha sees: the product photo shows.
  • A number: 2.5 seconds, Google's line for a good LCP from lesson 17.1.
  • A device: a mid-range phone. In the lab, that's DevTools' Slow 4G and a CPU 4 times slower, on a phone's screen.
  • A tool: Chrome in the lab, taking the middle of 5 loads.

The owner writes her first line:

"The product photo shows within 2.5 seconds on a mid-range phone."

Turning the line into a check

First, the photo needs a name the browser can report. That's the elementtiming attribute, from lesson 11.3:

The product photo, with a nameHTML
<img src="green-tea-800.jpg" width="1600" height="1067"
  elementtiming="product-photo" alt="A cup of green tea">
  • Lines 1 and 2 are the photo's tag. elementtiming="product-photo" asks Chrome to report when this image is painted. Nothing on the page looks different.

Then the check reads that report. Element Timing is the browser feature that sends it. Each named element gets an entry, with its renderTime: when it was painted.

The first line, as a checkJavaScript
new PerformanceObserver((list) => {  for (const entry of list.getEntries()) {    if (entry.identifier !== "product-photo") continue;    const shown = Math.round(entry.renderTime);    console.log(`The product photo showed at ${shown} ms: ${shown <= 2500 ? "meets" : "misses"} the spec`);  }}).observe({ type: "element", buffered: true });
  • Line 1 makes a PerformanceObserver: the browser calls its function with each new entry of the kind it watches.
  • Line 3 skips entries for any other element.
  • Line 4 rounds the photo's paint time to whole milliseconds.
  • Line 5 compares it with 2,500 ms and prints a line such as The product photo showed at 1528 ms: meets the spec.
  • Line 7 starts watching. buffered: true also hands over entries from before the script ran.

Element Timing is only in Chrome. That's enough here: the check runs in Chrome, in the lab, on every prototype.

Ravi runs it on Meera's design. The photo showed at 1,528 ms. The check passes, and the owner is pleased. But Meera frowns at the frames. "The heading jumped to Caveat at almost three seconds," she says. "That's not finished." She's right. The line checked only the photo, and the photo was never the problem.

A line for the whole first screen

So they write a better line together:

"On a mid-range phone, the first screen is complete within 2.5 seconds: the product photo, a picture in the film's box, and the words in their own fonts."

The better line, as a checkPop out in the code editor (opens in a new tab)JavaScript
// "The first screen is complete within 2.5 s on a mid-range phone"const line = 2500;const designs = {  today: { photo: 1264, film: null, fonts: null },  meera: { photo: 1528, film: 1910, fonts: 2852 },}; for (const [name, parts] of Object.entries(designs)) {  const complete = Math.max(parts.photo, parts.film ?? 0, parts.fonts ?? 0);  console.log(`${name}: complete at ${complete} ms, ${complete <= line ? "meets" : "misses"} the spec`);}
  • Line 1 is the line itself, as a comment. Line 2 is its number.
  • Lines 4 and 5 hold each design's recorded parts. null means the page has no film, or no web font.
  • Line 9 takes the latest part. The first screen is complete only when its last part is. ?? 0 counts a missing part as done at once.
  • Line 10 prints today: complete at 1264 ms, meets the spec and meera: complete at 2852 ms, misses the spec.

Meera's design misses by 352 ms. Here is every design so far against the line, plus the one the team agrees on later:

When the first screen was complete on Asha's phone, against a line at 2,500 ms. Today's page: 1,264 ms, inside the line. + the film: 1,469 ms, inside the line. + the carousel: 1,460 ms, inside the line. + the two fonts: 2,376 ms, inside the line. Meera's design: 2,852 ms, past the line. The agreed design: 1,761 ms, inside the line.the spec line, 2.5 sToday's page1,264 ms+ the film1,469 ms+ the carousel1,460 ms+ the two fonts2,376 msMeera's design2,852 msmissesThe agreed design1,761 ms0 s1 s2 s3 s
Each bar ends when the first screen was complete, drawn to scale. Each piece alone stayed inside the 2.5-second line. All three together went past it. The agreed design came back inside.

Why it matters: the check doesn't argue. It says yes or no, in the same way for the owner, Meera and Ravi.

Real-life analogyA tailor's measurements

"Make it fit" is a wish. "Chest 96 cm, sleeves 62 cm" is a measurement anyone can check with a tape. And a good tailor measures the person who will wear the suit, not himself.

In real life: "Make it fit"
In a web page: "Make it fast"
In real life: The measurements on the order
In a web page: The spec line's moment, number and device
In real life: The tape measure
In a web page: The check in the lab
In real life: Measuring the person who will wear it
In a web page: Testing on Asha's phone, not Ravi's laptop

Where to draw the line is a choice too. Slide it and see which designs meet it:

Playground: where to draw the spec's line
First screen complete, against 2,500 ms
  1. Today's home page1,264 ms: meets
  2. Today's page with the film1,469 ms: meets
  3. Today's page with the carousel1,460 ms: meets
  4. Today's page with the film and the carousel1,907 ms: meets
  5. Today's page with the two fonts2,376 ms: meets
  6. Today's page with the film and the two fonts2,684 ms: misses
  7. Today's page with the carousel and the two fonts2,443 ms: meets
  8. Meera's design2,852 ms: misses
  9. The agreed design1,761 ms: meets
Try it yourself
2,500 ms: 7 of 9 designs meet it

Each row is one design, and when its first screen was complete on Asha's phone. A design meets the line when it was complete at or before it.

Today's page, every mix of Meera's pieces, and the design the team agreed: the middle of 5 loads each, on Asha's phone in the lab.

The same line goes with the page from start to finish. Today it checks prototypes. Lesson 39.2 ran checks like it on every pull request. After launch, the shop's goal from lesson 41.3 watches real visits.

Try the design on a slow phone first

Meera is puzzled. Before the meeting, she opened Ravi's prototype in Chrome on her laptop. She even made the window the size of a phone, with DevTools' device toolbar. It looked complete at once.

So the course loaded Meera's design her way too: a phone-sized window on the laptop, with nothing slowed. Its first screen was complete at 85 ms. Drag the time, and compare the two screens:

Playground: Meera's laptop and Asha's phone
The same design, the same moment
Meera's laptop, nothing slowed: the film playing, the green tea photo and the heading in Caveat
Meera's laptop, nothing slowed
Asha's phone in the lab
Try it yourself
At 1,000 ms

On the laptop: the film playing, the green tea photo and the heading in Caveat. On the phone: a blank screen.

Meera's design, loaded 5 times on each. Both screens are the size of Asha's phone. The laptop has its own network and CPU; the phone is DevTools' Slow 4G and a CPU 4 times slower. Each strip is the middle load.

At 250 ms, the laptop shows the whole design. Asha's phone is still blank at 1,000 ms. A phone-sized window copies the phone's screen. It doesn't copy the phone's network or its CPU. Hogan warns about this. Most people in a company "are probably accessing your site on newer hardware with fast connections".

Real-life analogyChecking a shop sign from across the street

A sign painter checks the letters up close, on the bench. They look perfect. But people read the sign from across a busy street. So the painter props it up and walks across the road to look.

In real life: Up close, on the painter's bench
In a web page: Meera's fast laptop
In real life: Across a busy street
In a web page: Asha's phone on a slow network
In real life: Walking across the road to look
In a web page: Loading the prototype slowed down, or on a real phone
In real life: Fixing the letters before they go on the shop
In a web page: Changing the design before it's built

Slow the laptop down

Chrome's DevTools can make a laptop behave more like Asha's phone. Throttling means slowing something down on purpose. Three settings matter:

  • The network: in the Network panel's Throttling menu, pick Slow 4G. DevTools' docs list presets for "fast 4G, slow 4G, or 3G", and you can add your own.
  • The CPU: in the Performance panel's capture settings, pick a CPU slowdown. The docs warn: "Throttling is relative to your computer's capabilities."
  • The screen: the device toolbar gives the page a phone's size.

The CPU setting needs care. Lesson 9.3 measured DevTools' fixed 4x slowdown on the course's laptop. It scored 77% of a mid-tier phone's score: a little slower than that phone. DevTools can also calibrate. It tests your computer, then finds the slowdown that matches a low-tier and a mid-tier phone. On the course's laptop, the mid-tier rate came out at 3.09x.

Even so, DevTools' docs call device mode "a first-order approximation". They add: "When in doubt, your best bet is to actually run your page on a mobile device." Lesson 37.1 showed how to open a laptop's page on a real Android phone.

Show the frames, not adjectives

The frames in this lesson are Chrome's own screenshots of each load. DevTools' Performance panel records the same, with its Screenshots option. Hogan suggests showing filmstrips like these when you talk about speed. That way you can "avoid numbers altogether". A designer sees the empty film box at 1.5 s. Nobody needs to say "slow".

web.dev's guide on fixing speed across a company suggests the same habit for photos. "Create a test page where images are published in different image qualities and dimensions", it says, and agree on one together. Ravi's prototype is that test page, for a whole design.

Why it matters: a prototype on a slow phone shows the cost while the design can still change cheaply. After launch, every change is a code change.

Trade, don't just say no

Ravi could say "no film, no carousel, no fonts". The page would be fast. But Meera would lose her design, and the owner would lose what she liked. Hogan warns that the "aesthetics versus performance" way of thinking turns into "designers versus developers". She quotes Harry Roberts on the better goal: "a whole team who all want to make beautiful, fast products, quickly."

Hogan's book lists three things to weigh for each choice:

  • The speed difference: how many requests and bytes it adds, and what the visitor sees later.
  • The look difference: what it does for the brand, and for how the page feels.
  • The cost to build: how long it takes, and whether the team can keep it working.

So the owner, Meera and Ravi sit down with the frames and the numbers. For each piece, they ask what it's for. Read each row across: the piece, what Meera drew, what they agreed, and why.

What the meeting agreed
The pieceWhat Meera drewWhat they agreedWhy
The filmIt plays by itself at the top, over and over.It stays at the top as a poster with a Play button. It downloads when Asha taps.Meera wants people to see the tea brewing. A poster shows the same picture at once.
The carouselThree teas that turn on their own every 3 seconds.A row of three photos that Asha swipes. No script, and nothing moves by itself.The owner wants all three teas seen. A swipe lets Asha choose when.
The fontsCaveat for the heading and Lora for the text.Caveat for the heading, asked for early. The phone's own font for the text.The handwriting is the shop's look. The text reads well in the phone's font.

Here are the changed parts of the agreed page, shortened:

The agreed top of the page, shortenedHTML
<link rel="preload" href="caveat.woff2" as="font" type="font/woff2" crossorigin>
<video preload="none" poster="brew-poster.jpg" src="brew.mp4"></video>
<button class="play" type="button">Play the film</button>
<div class="row">
  <img src="green-tea-800.jpg" fetchpriority="high" alt="A cup of green tea">
  <img src="mint-tea-800.jpg" loading="lazy" alt="A cup of mint tea">
  <img src="chamomile-800.jpg" loading="lazy" alt="A cup of chamomile tea">
</div>
  • Line 1 asks for Caveat early, before the CSS asks for it. That's a preload, from lesson 20.2.
  • Line 2 is the film. preload="none" tells the browser to download none of it yet. The poster is the film's first frame, as a still picture.
  • Line 3 is the Play button. A small script starts the film when Asha taps it.
  • Lines 4 to 8 are the row of three teas. Line 5 is the same product photo, with fetchpriority="high". Lines 6 and 7 have loading="lazy", so the browser may wait to fetch them.
The row: swipe, and each photo snaps into placeCSS
.row { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; }
.row img { flex: 0 0 100%; scroll-snap-align: start; }
  • Line 1 lays the photos in one row that scrolls sideways. scroll-snap-type makes the row stop with a photo lined up.
  • Line 2 makes each photo as wide as the row, and lines it up by its left edge.

No script at all. web.dev's carousel guide says scroll snap makes "carousel-like transitions using only HTML and CSS" possible. Its Fetch Priority guide explains the photo's hint: in a carousel, "only the first visible image needs a higher priority". Here is the result on Asha's phone:

Asha's phone at 2.0 s. Meera's design: the film playing, the green tea photo and the heading in a stand-in font; film: playing, 157 kB; heading: a stand-in font; complete at 2.9 s. The agreed design: the film's poster with a Play button, the green tea photo and the heading in Caveat; film: poster, 11 kB; heading: Caveat; complete at 1.8 s.Meera's designAsha's phone at 2.0 s: the film playing, the green tea photo and the heading in a stand-in fontfilm: playing, 157 kBheading: a stand-in fontcomplete at 2.9 sThe agreed designAsha's phone at 2.0 s: the film's poster with a Play button, the green tea photo and the heading in Caveatfilm: poster, 11 kBheading: Caveatcomplete at 1.8 s
Both designs at 2.0 s. The agreed design shows the film's first frame as a poster and the heading in Caveat. It was complete 1.1 s sooner.

The agreed design was complete at 1,761 ms. That's inside the line, and 1,091 ms sooner than Meera's design. The phone downloaded 125 kB. The poster was 11 kB, and none of the film came until a tap.

The two lazy photos still arrived early, by 2.1 s. Chrome fetches lazy images in a sideways row before they're scrolled to. web.dev's carousel guide explains why: the loading is less likely to be noticed, "at the cost of more downloads".

It's still 497 ms later than today's plain page. That's the price the owner chose to pay for the film, the three teas and the handwriting. And it fits her line.

Real-life analogyA party with a fixed budget

You're planning a party with a fixed budget. You can have the fancy cake if you skip the band. Or the band, with a homemade cake. The budget doesn't say no to anything. It makes you choose what matters most.

In real life: The party's budget
In a web page: The spec line: complete within 2.5 s
In real life: The cake and the band
In a web page: The film, the carousel and the fonts
In real life: A playlist instead of a band
In a web page: A poster instead of a film that plays by itself
In real life: Choosing together
In a web page: The owner, Meera and Ravi at one table

Hogan calls this approaching new designs with a performance budget: "you can make performance sacrifices in one area of a page and make up for them in another." Her example: "You can call a few more font weights because you found equivalent savings by removing some image requests."

When you can't agree, test it

Some choices can't be settled at a table. Hogan writes: "If there's one thing I've learned from years of doing A/B testing, it's that I will always be surprised." Once, adding "160 KB of hidden images" to a page brought "a 12% increase in bounce rate" from people on phones. Other times, visitors liked extra font weights, even though the page got slower. Lesson 40.3 showed how to test a change on real visitors.

Why it matters: a plain "no" ends the talk. A choice with prices on it keeps the design's idea and Asha's time.

Can this spec line be checked?

Each card is a line someone might write in a spec. Sort it: can a check pass or fail it, or not yet?

Can this spec line be checked?
  • The first screen is complete within 2.5 s on Slow 4G with a CPU 4 times slower.
  • The page feels fast.
  • The product photo shows within 2.5 s on a mid-range phone, as the middle of 5 lab loads.
  • Fast on every phone.
  • Within 2.5 seconds.
  • The home page sends at most 150 kB to a phone before the first tap.
  • As fast as possible.
  • 9 phone visits in 10 show their LCP within 1,000 ms, over four weeks of RUM.
Try it yourself
0 of 8 correct

Sort each line by whether a check could pass or fail it.

Choose a category for every card. You can change an answer at any time; Reset clears them all.

A line that can be checked names a moment, a number and a device. The rest are wishes. Turn each wish into a line before the work starts.

Common mix-ups

  • "Speed is the developers' job. Design is only how it looks." No. Hogan writes that "the decisions made by designers are what typically drive the rest of how a website is built". Meera's design set its first screen's time before any code.
  • "It looked complete in a phone-sized window, so it's fast." No. With nothing slowed, Meera's design was complete at 85 ms on the laptop. On Asha's phone, it took 2,852 ms.
  • "A short film costs almost nothing." No. Meera's film was 8 seconds long, and still the biggest file on the page: 157 kB. A film that plays by itself downloads all of it.
  • "A carousel gets more products seen." No. web.dev says people often ignore slides that move by themselves. And Meera's carousel moved the product photo away at 4.9 s.
  • "A spec line about one thing covers the page." No. The photo line passed Meera's design while the heading kept changing. A check sees only what it names.
  • "A speed talk ends with the developer saying no." No. The agreed design kept the film, the three teas and Caveat, and met the line.

Practice exercises

Answer first, then use the hints.

Exercise 1 · Warm-upA late font

A new page's parts showed at these times on the mid-range phone. What does the check print?

Starter codePop out in the code editor (opens in a new tab)JavaScript
// A new page on the mid-range phone, in ms
const parts = { photo: 1300, film: 2100, fonts: 2600 };
const complete = Math.max(parts.photo, parts.film, parts.fonts);
console.log(`complete at ${complete} ms: ${complete <= 2500 ? "meets" : "misses"} the spec`);

Answer, then press Check. Spacing and letter case don’t matter.

    Exercise 2 · Warm-upWithout the film

    The same page without its film, and with its fonts arriving sooner. What does the check print now?

    Starter codePop out in the code editor (opens in a new tab)JavaScript
    // The same page without the film, in ms
    const parts = { photo: 1300, film: null, fonts: 2200 };
    const complete = Math.max(parts.photo, parts.film ?? 0, parts.fonts ?? 0);
    console.log(`complete at ${complete} ms: ${complete <= 2500 ? "meets" : "misses"} the spec`);

    Answer, then press Check. Spacing and letter case don’t matter.

      Exercise 3 · PracticeThe film and the fonts

      Keep only the film and the two fonts. When was the first screen complete on Asha's phone?

      Answer, then press Check. Spacing and letter case don’t matter.

        Exercise 4 · PracticeA tighter line

        If the line were 2,400 ms, how many of the nine designs would meet it?

        Answer, then press Check. Spacing and letter case don’t matter.

          Exercise 5 · ChallengeHogan's example budget

          In Hogan's example performance budget, what is the most total page weight it allows?

          Answer, then press Check. Spacing and letter case don’t matter.

            Exercise 6 · ChallengeThe film in the Network panel

            Open Meera's prototype. Open DevTools' Network panel, set Throttling to Slow 4G, and reload. What does the Type column show for brew.mp4?

            Answer, then press Check. Spacing and letter case don’t matter.

              Check your understanding

              For each question, ask: is this about what a piece costs, about the spec, about the device, or about the conversation?

              The designers and product managers quiz · 7 questionsScore: first tries count
              1. Question 1 of 7Meera's design looked complete at once in a phone-sized window on her laptop. Why?

                Choose an answer to see the explanation.

              2. Question 2 of 7Which of these spec lines can a check pass or fail?

                Choose an answer to see the explanation.

              3. Question 3 of 7What does this spec check print?

                Read the code, then predictPop out in the code editor (opens in a new tab)JavaScript
                const line = 2000;
                const parts = { photo: 1500, film: null, fonts: 2200 };
                const complete = Math.max(parts.photo, parts.film ?? 0, parts.fonts ?? 0);
                console.log(complete <= line ? "meets" : "misses");

                Choose an answer to see the explanation.

              4. Question 4 of 7In Meera's design, what happened to the green tea photo about 5 seconds after Asha opened the page?

                Choose an answer to see the explanation.

              5. Question 5 of 7The owner's first line, about the product photo only, passed Meera's design. What did it miss?

                Choose an answer to see the explanation.

              6. Question 6 of 7You set DevTools' CPU throttling to 4x slowdown on your laptop. What have you got?

                Choose an answer to see the explanation.

              7. Question 7 of 7What should a talk about a slow design start from?

                Choose an answer to see the explanation.

              Key takeaways

              • Design and product choices set a page's speed before any code. A mock-up has no loading time, so it can't show the cost.
              • A film that plays by itself downloads all of it. A carousel that turns by itself moves what Asha is looking at. Web fonts change the words late.
              • Pieces that each fit alone can miss together: they share the phone's one slow line.
              • Write speed into the spec as a check: a moment, a number, a device and a tool. Name everything that matters on the first screen.
              • Try every prototype on a slowed laptop or a real phone. A phone-sized window copies only the screen.
              • Show frames, not adjectives. Then weigh speed, looks and the cost to build, and trade within the line.

              Remember the one-liner.
              Price each piece in the visitor's time, write the line into the spec, try it on a slow phone, and trade instead of saying no.

              Sources

              The facts on this page come from these books, guides and docs:

              Coming next: Performance in interviews. How speed comes up in frontend interviews, and how to answer with measurements and choices like the ones in this lesson.

              CompleteFrontend Clear concepts. Working examples.