FE4: Measuring speed

Lesson 2 of 5 ยท reading 15โ€“25 minutes; practice and project time is on the module page

Lab data and field data

๐ŸŽฏYou'll be able to

Tell lab data from field data and choose which one answers a given question.

๐Ÿ The everyday picture

A car's mileage in a test lab differs from what you get in Pune traffic with the AC on. Both are useful: the lab for comparing changes, the road for knowing what really happens.

๐Ÿ“˜What it really is

๐Ÿ“A worked example

Kirana's lab and field results for the product page:

Source LCP Notes
Lighthouse on the developer's laptop, no throttling 1.2 s Fast laptop, office Wi-Fi
Lighthouse with mobile throttling 3.4 s Closer to reality
CrUX field data (75th percentile) 3.9 s Real customers
RUM, split by device 2.1 s on high-end phones, 4.6 s on low-end Low-end phones are the problem

The RUM split showed the fix must work on low-end phones, where most orders come from in the outer suburbs.

๐ŸŒWhere it's used

๐Ÿ“Case scenario

A developer reports "LCP is 1.1 s, all good", but customers say pages are slow. The test was unthrottled on a laptop. Rerunning with mobile CPU and network throttling gives 3.6 s, and field data agrees. The team adds a throttled Lighthouse check to every pull request and a RUM dashboard split by device.

๐Ÿ–ฑ๏ธTry it

Add the web-vitals library to your Kirana app and log LCP, INP and CLS to the console (or a simple endpoint). Compare an unthrottled and a throttled run, and note the difference.

โš ๏ธCommon mistakes

๐Ÿ› ๏ธFor your project

The starter kit's e2e/performance.spec.ts is lab data with fixed throttling; write down its settings in your Project 3 report.

โœ…Quick check

When should you trust field data over lab data?

Show the answer

For knowing how real users experience the site; lab data is better for testing whether a specific change helped.

Why throttle CPU and network when testing?

Show the answer

To get closer to the phones and networks real users have.

โ† PreviousCore Web Vitals
ProLearners Assist