Web platform · 26 concepts
Web performance
Measure a slow page the right way, explain LCP, INP and CLS exactly, and fix the real cause.
Asked in these mock interviews
Part 1 · 3 concepts
Measuring performance
- 01
Lab data vs field data, p75 and RUM
Lab data (Lighthouse, DevTools) is one controlled run that helps you debug; field data (CrUX, your own RUM) is what real users felt, and Google judges a page by the…
- 02
Chrome DevTools Performance panel and Lighthouse
To debug a slow page you record it in the DevTools Performance panel with CPU and network throttling, read the main-thread flame chart for long tasks, layout and paint…
- 03
PerformanceObserver, the web-vitals library and sending RUM data
Browsers expose performance entries (navigation, resource, paint, largest-contentful-paint, event, layout-shift, long-animation-frame) through PerformanceObserver, and…
Part 2 · 5 concepts
Core Web Vitals, exactly
- 04
Core Web Vitals in 2026: LCP, INP, CLS
The three Core Web Vitals are LCP (loading, good at 2.5 s or less), INP (responsiveness, good at 200 ms or less; it replaced FID on 12 March 2024) and CLS (visual…
- 05
LCP: what counts, the four subparts and the fixes
LCP is the render time of the largest image or text block visible in the viewport, and you fix it by splitting it into TTFB, resource load delay, resource load duration…
- 06
INP: phases, what counts, and how to fix a slow interaction
INP is the time from a click, tap or key press until the next frame is painted, reported for one of the slowest interactions of the visit, and it splits into input…
- 07
CLS: the score, session windows, causes and fixes
CLS is a unitless score: each unexpected layout shift scores impact fraction times distance fraction, shifts are grouped into session windows (gaps under 1 s, at most 5…
- 08
Supporting metrics: TTFB, FCP, TBT and Speed Index
TTFB (good <= 0.8 s) and FCP (good <= 1.8 s) are diagnostic metrics for loading, and Total Blocking Time is the lab sum of every long task's time over 50 ms, used as…
Part 3 · 5 concepts
Loading fast: critical path, hints, images, fonts, caching
- 09
Critical rendering path and render-blocking resources
The browser must build the DOM and CSSOM, combine them into a render tree, then lay out and paint; CSS in the head blocks rendering, classic scripts block parsing, and…
- 10
Resource hints: preload, preconnect, modulepreload, fetchpriority, Early Hints
Resource hints let you tell the browser about important resources earlier than it would find them: preconnect opens a connection, preload fetches a file now…
- 11
Images: formats, srcset and sizes, lazy loading, dimensions
Serve each user the smallest good-enough image: modern formats (AVIF, WebP), responsive sizes with srcset and sizes, explicit dimensions to avoid CLS, lazy loading only…
- 12
Web fonts without slow text or layout shifts
Web fonts can hide text (slow FCP/LCP) or swap late (CLS); you control this with font-display, early discovery (preload with crossorigin or inline @font-face), smaller…
- 13
Caching and CDNs for speed
The fastest request is the one you do not make: give content-hashed static files a one-year immutable cache, make HTML revalidate, serve everything from a CDN near the…
Part 4 · 5 concepts
JavaScript cost and the main thread
- 14
JavaScript cost: bundle size, code splitting and tree shaking
JavaScript is the most expensive byte on the web because it must be downloaded, parsed, compiled and executed on the main thread, so you measure the bundle, split it by…
- 15
Long tasks and yielding to the main thread
A long task is any main-thread task over 50 ms; while it runs the browser cannot respond or paint, so you break work into chunks and yield between them with…
- 16
Moving work off the main thread with Web Workers
A Web Worker runs JavaScript on another thread with no DOM access, talking to the page by postMessage with structured-clone copies (or zero-copy transfers), so it suits…
- 17
Rendering work: style, layout, paint, composite and layout thrashing
Each frame the browser may recalculate style, run layout, paint and composite; changing geometry triggers layout (expensive), changing colours triggers paint, and…
- 18
Third-party scripts: cost, loading and governance
Tag managers, analytics, chat widgets, A/B testing and ads often cost more main-thread time than your own code, so you inventory them, load them late (defer, after…
Part 5 · 4 concepts
Rendering strategies and React
- 19
CSR, SSR, SSG and ISR: what each does to the metrics
CSR sends a shell and renders with JavaScript (slow first content, simple hosting), SSR renders HTML per request (fast FCP/LCP, TTFB risk, hydration cost), SSG renders…
- 20
Streaming SSR, selective hydration, islands and Server Components
Newer strategies cut the cost of SSR: streaming sends HTML in chunks as data is ready, selective/progressive hydration makes the important parts interactive first…
- 21
React performance: re-renders, memoisation, transitions and the Compiler
In React, slow screens usually come from rendering too much too often, so you profile first, then cut work: keep state close to where it is used, split contexts…
- 22
Long lists: virtualisation, pagination and content-visibility
Rendering thousands of rows creates a huge DOM that slows every frame, so you render only the visible window plus a small overscan (virtualisation), or paginate, or let…
Part 6 · 2 concepts
Instant navigations
- 23
The back/forward cache (bfcache)
The bfcache keeps a full snapshot of a page in memory, JavaScript state included, so Back and Forward restore it instantly; pages lose eligibility through unload…
- 24
Speculation Rules, prefetching and prerendering
The Speculation Rules API lets a page tell Chromium which next pages to prefetch or fully prerender, with an eagerness level, so the next navigation can show with…
Part 7 · 2 concepts
Keeping it fast
- 25
Memory leaks in long-lived pages
A leak is memory that stays reachable after you no longer need it, usually through forgotten listeners, timers, subscriptions, caches or detached DOM nodes, and you…
- 26
A performance method, budgets and CI checks
Senior answers follow a method: measure real users, find the biggest problem by user impact, fix the cause, verify in the field, and stop regressions with budgets in CI…
Your first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.