FSD Frontend System Design

Part III β€” The Speed Β· Lesson 5.1

Performance Overview

In one lineThree metrics describe what a user feels: is it there, does it respond, does it stay still.

Where you've seen itA news article that paints, then shifts as an ad slot fills β€” and your tap lands on the wrong link.

  • Time14 min
  • DiagramCore Web Vitals on a page-load timeline
  • Chapter5 Β· Performance

Diagram

diagram
diagram
diagram

How it works

  1. LCP marks when the largest visible element renders β€” usually a hero image or headline block.
  2. INP measures the worst interaction latency across the visit, replacing the old FID (which only measured the first one).
  3. CLS sums unexpected layout shifts across the page's life, weighted by how much moved.
  4. All three are measured at p75 of real users (see 4.5) β€” a metric measured on your laptop is not a metric.
  5. Fix in dependency order: TTFB β†’ render-blocking resources β†’ LCP element β†’ main-thread work.

Trade-offs

MetricCheapest big win
LCPPreload the hero image, cut render-blocking CSS
INPBreak up long tasks, defer non-critical JS
CLSwidth/height on images, reserve ad slots
TTFBCDN, edge caching, faster origin

Interview angle

"Which metric would you optimise first, and why?"

  • Start with LCP, because it usually shares a root cause with TTFB and render-blocking resources β€” one fix moves several numbers.
  • Then INP, since main-thread work is what makes an app feel broken even after it looks loaded.
  • CLS is usually the cheapest fix of the three: dimensions on media and reserved space for late-injected content.

Recap

  • There, responsive, stable β€” LCP, INP, CLS.
  • One main thread does parsing, JS, layout, and paint; long tasks freeze all of it.
  • Always p75 of real users, never a single lab run.