FE4: Measuring speed

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

Finding what's slow

๐ŸŽฏYou'll be able to

Use a performance trace to find the element, script or request behind a slow metric.

๐Ÿ The everyday picture

A doctor doesn't prescribe medicine because a patient "feels unwell". They check temperature, pulse and blood tests to find the cause. Performance tools are the tests for a slow page.

๐Ÿ“˜What it really is

๐Ÿ“A worked example

Recording Kirana's product page on a throttled profile showed:

Finding Effect
Product photo is a 1.8 MB JPEG, discovered only after JavaScript runs LCP 3.9 s
A promotional banner loads after 1.5 s and pushes content down CLS 0.24
A 220 ms task on tapping "Add to cart" (recalculating offers for the whole cart) Some slow taps
A chat widget loading 400 KB of JavaScript at start-up Main thread busy early

This list became the plan for Lessons 4 and 5, in order of effect.

๐ŸŒWhere it's used

๐Ÿ“Case scenario

Taps on a filter button feel sluggish. The Performance panel shows each tap triggers a 300 ms task that re-sorts 5,000 products and re-renders the list. Moving sorting to happen once per filter change, memoising the result and virtualising the list (FE1) brings the task under 50 ms, and INP drops into the "good" range.

๐Ÿ–ฑ๏ธTry it

Record your Kirana product page in the Performance panel with throttling. List the LCP element, any layout shifts with their causes, and the three longest tasks, with what each was doing.

โš ๏ธCommon mistakes

๐Ÿ› ๏ธFor your project

In Project 3, record a trace of /deals in the starter kit and note the three biggest causes before changing any code.

โœ…Quick check

What is a long task, and why does it matter?

Show the answer

A main-thread task over 50 ms; while it runs, the page can't respond to taps, which hurts INP.

Why change one thing at a time when fixing performance?

Show the answer

So you know which change helped and by how much.

โ† PreviousLab data and field data
ProLearners Assist