FSD Frontend System Design

Chapter 5 · Performance

Interview drill

7 questions from this chapter. Answer each one out loud first, then open it to compare.

  1. 5.1"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.

    Review 5.1 Performance Overview →

  2. 5.2"How do you justify a performance sprint to a product manager?"
    • Convert the metric into their language: p75 LCP, the conversion delta measured or benchmarked, and the revenue that implies.
    • Show the device gap — most stakeholders have never seen the site on a mid-tier Android on 4G.
    • Ask for a budget in CI instead of a one-off sprint, so the win doesn't erode by the next quarter.

    Review 5.2 Performance Importance →

  3. 5.3"Lighthouse says 98. Users say it's slow. Who's right?"
    • Both — Lighthouse measures one simulated device, field data measures the population.
    • Look at p75 and p95 by device class and route; the regression is almost always concentrated somewhere specific.
    • Keep lab for gating merges and field for alerting; using either alone leaves a blind spot.

    Review 5.3 Performance Monitoring →

  4. 5.4"Walk me through debugging a slow page."
    • Throttle, reload, open the waterfall, and find what delays the LCP element's start time.
    • Chains and render-blocking resources first; only then look at bundle size and main-thread work in the flame chart.
    • Verify on a real mid-tier device, then lock the win in with a CI budget (4.5) so it doesn't regress.

    Review 5.4 Performance Tools →

  5. 5.5"The hero image is the LCP element and it's slow. Fix it."
    • First ask when it starts, not how long it takes — usually it's discovered late inside CSS or JS.
    • preload with fetchpriority="high", serve AVIF/WebP with srcset, and set explicit dimensions to protect CLS.
    • Then check the origin: a slow TTFB delays everything downstream regardless of image size.

    Review 5.5 Network Optimization →

  6. 5.6"SSR or CSR for an e-commerce site?"
    • Per route: product and category pages need SEO and fast LCP → SSG/ISR at the edge; cart and account are CSR behind login.
    • Price and stock are the genuinely dynamic bits — fetch those client-side or stream them into a static shell.
    • Name hydration cost explicitly: SSR that ships a huge bundle can feel slower than CSR despite a better LCP.

    Review 5.6 Rendering Patterns →

  7. 5.7"Your bundle is 500KB. Where do you start?"
    • Open the treemap first — in most apps two or three dependencies own half the weight.
    • Route-split, replace the heavyweights, verify tree shaking is actually happening (named ESM imports, sideEffects).
    • Lock it in with a size-limit gate in CI (4.5), or it grows straight back next quarter.

    Review 5.7 Build Optimization →