The Frontend Performance Playbook: From Core Web Vitals to Memory Leaks
INP replaced FID as a Core Web Vital in 2024, so any team optimizing for search ranking or user experience must now measure and improve full-lifecycle interaction latency, not just first input. The techniques here form the baseline for passing a modern frontend performance interview and for shipping a site that stays fast under real user conditions.
Performance optimization spans the entire stack, from network requests down to rendering and runtime behavior. Core Web Vitals—LCP, INP, and CLS—now anchor Google's quality signals, with INP replacing FID in 2024 to capture full-lifecycle interaction latency. Measuring these correctly requires the Performance API, PerformanceObserver, or the web-vitals library, and the data feeds into a monitoring pipeline that tracks regressions over time.
Loading performance hinges on shrinking the critical rendering path. Code splitting, route-based lazy loading, preload/prefetch hints, and inlining critical CSS all reduce the time to first paint. On the resource side, modern image formats (AVIF, WebP), responsive srcset, native lazy loading, and font subsetting cut payload weight. HTTP caching layers—strong cache for hashed assets, negotiated cache for HTML, and Service Worker strategies like Cache First or Stale While Revalidate—keep repeat visits fast.
Rendering and runtime optimizations prevent jank. Batching DOM writes, sticking to compositor-only properties (transform, opacity), virtualizing long lists, and offloading heavy work to Web Workers keep the main thread responsive. Framework-specific techniques—React.memo, useMemo, useCallback, state colocation, and Vue's v-memo, shallowRef, and KeepAlive—prevent wasted re-renders. Memory leaks from uncleaned timers, event listeners, and detached DOM references are caught with Chrome's heap snapshots and allocation timelines.
INP's adoption signals that Google now penalizes sluggish interactions anywhere on the page, not just the first click, which raises the bar for SPA responsiveness.
immutable in Cache-Control is underused; it prevents wasted revalidation requests when a hashed URL guarantees content stability.
The shift from FID to INP makes long tasks and main-thread congestion more dangerous than before, since a single slow interaction can ruin the metric.
Framework-level optimizations like React.memo and v-memo are stopgaps—the real fix is colocating state so that changes don't propagate to unrelated subtrees.
103 Early Hints are replacing HTTP/2 Server Push because they let the browser decide what to preload, avoiding over-pushing and cache waste.