Skip to main content
InterviewHubPRO
HomeTracksSection 12: Web Vitals & Performance (50 Qs)
Section 12 of 6450 Questions (1 Per Page)

Core Web Vitals & Web Performance Engineering Master Interview Bank

LCP (Largest Contentful Paint), INP (Interaction to Next Paint), CLS (Cumulative Layout Shift), Critical Rendering Path, Resource Hints, and performance profiling.

Curriculum Roadmap & Learning Path

3 Stages
Tip: Click any stage card above to instantly filter the question bank to that topic.3 Connected Milestones
50 of 50 Qs

Part 1: Basic & Foundational Concepts (Junior / Entry-Level)

12 Questions
1
Junior#web-vitals#Basic

What are Google's Core Web Vitals and why do they matter?

Core Web Vitals are a set of three specific, user-centric performance metrics established by Google that measure real-world user experience on the web: LCP (Largest Contentful Paint): Measures loading performance (How fast does the main content appear?).

2
Junior#web-vitals#Basic

What is Largest Contentful Paint (LCP) and what are its thresholds?

LCP measures the time from when the user initiates page loading until the largest image, video thumbnail, or text block within the initial viewport is completely rendered on screen.: Good (Green): \le 2.5\text{ seconds} (Target: 75% of page visits should meet this).

3
Junior#web-vitals#Basic

What is Interaction to Next Paint (INP) and how did it replace FID?

FID (First Input Delay - Legacy): Measured only the very first user click on a page, and measured only the input delay (waiting for the main • INP (Interaction to Next Paint - Effective March 2024) • Observes all click, tap, and keyboard interactions throughout the entire lifespan of the page visit.

4
Junior#web-vitals#Basic

What is Cumulative Layout Shift (CLS) and how is it calculated?

CLS measures the unexpected movement of visible elements during page loading. If a user is about to click "Cancel", and an un-dimensioned advertisement suddenly pops in, shifting the page down and causing them to click "Confirm Order", that is a catastrophic layout shift.

5
Junior#Forms#Performance

What is Time to First Byte (TTFB) and how does it impact frontend performance?

TTFB measures the time between the browser sending the initial HTTP request and receiving the very first byte of response data from the web server: Components: DNS Lookup + TCP Handshake + TLS Negotiation + Server Processing Time • Why Critical: TTFB is the baseline foundation for all other metrics.

6
Junior#web-vitals#Basic

First Contentful Paint (FCP) vs. Largest Contentful Paint (LCP).

FCP (First Contentful Paint): Marks the moment when the browser renders the first bit of DOM content (a background color change, a navigation • LCP (Largest Contentful Paint): Marks when the primary content that the user came to see (the main article heading or product hero image) is rendered.

7
JuniorCode#Forms#Performance

How does the browser measure Web Vitals programmatically (`PerformanceObserver`)?

The modern browser exposes the PerformanceObserver API.

8
Junior#web-vitals#Basic

Lab Data (Synthetic / Lighthouse) vs. Field Data (CrUX / RUM).

Lab Data (Synthetic): Tests run in a controlled environment with simulated hardware (emulated Moto G4 phone, throttled 4G network) • Field Data (Real User Monitoring - RUM / Chrome UX Report - CrUX): Telemetry captured from millions of real human users browsing on actual.

9
Junior#web-vitals#Basic

What causes high CLS on modern web pages and what are the simplest fixes?

Images, ads, or iframes without explicit dimensions • Dynamically injected content (banners, newsletter prompts) inserted above existing content • Web fonts swapping (FOUT - Flash of Unstyled Text) • Always include width and height attributes on tags, or use CSS aspect-ratio: 16 / 9;.

10
Junior#SSR & Hydration

How do CSR, SSR, and SSG compare regarding Web Vitals?

CSR (Client-Side Rendering): Fast TTFB, but horrible LCP and FCP • SSR (Server-Side Rendering): Great FCP and LCP because pre-rendered HTML arrives immediately • SSG (Static Site Generation): The Gold Standard for Web Vitals.

11
Junior#web-vitals#Basic

Font Loading Strategies: `font-display: swap` vs. `optional`.

font-display: swap • Displays fallback system font immediately while web font downloads • Risk: Causes visible text reflow and layout shifts (CLS) if glyph widths differ! • font-display: optional (Recommended for Zero CLS).

12
Junior#Docker & Containers

Why Image Dimensions (`width`/`height` or `aspect-ratio`) prevent layout shifts.

When an image tag has ``: The browser calculates the intrinsic aspect ratio (800/400 = 2:1) • Before the image file finishes downloading over the network, the browser immediately calculates the height and reserves the exact box space in • Surrounding text does not jump when the image pixels finally arrive.

Part 2: Core Architecture & Implementation (Mid-Level)

12 Questions
13
Senior#System Design

Breaking down LCP into its 4 Sub-Parts.

To optimize LCP, you must measure its four distinct sub-components: \text{Total LCP} = \text{TTFB} + \text{Resource Load Delay} + \text{Resource Load Duration} + \text{Element Render Delay}: TTFB (Time to First Byte): Time to receive initial HTML response.

14
SeniorCode#Docker & Containers#System Design

How does `fetchpriority="high"` accelerate LCP image discovery?

Browsers typically prioritize CSS, fonts, and scripts over images. If a page has 20 images, the hero LCP image sits in the low-priority queue.

15
SeniorCode#System Design

Breaking down INP into its 3 Phases.

When a user clicks a button.

16
SeniorCode#System Design

How does `scheduler.yield()` break up Long Tasks to improve INP?

A JavaScript loop running for 300ms locks the main thread, delaying all user clicks. Historically developers used setTimeout(..., 0) which adds unpredictable 4ms timer clamp delays.

17
Senior#System Design

How do Web Workers offload JavaScript to maintain 0ms Input Delay?

Moving heavy JSON parsing, cryptography, audio processing, or search filtering off the main thread: Main thread handles ONLY user input and DOM painting • Background Worker handles data processing • The UI stays responsive at 60 FPS with near-zero INP input delay even during heavy compute operations.

18
Senior#System Design

What are Long Tasks (>50ms) and Long Animation Frames (LoAF)?

Long Task: Any JavaScript execution that monopolizes the browser main thread for longer than 50 milliseconds • 50ms threshold: Human eyes perceive lag if a system fails to respond within 100ms • LoAF (Long Animation Frames API) • The modern replacement for the Long Tasks API.

19
SeniorCode#System Design

How do Resource Hints optimize the Critical Rendering Path?

Resource hints (preconnect, dns-prefetch, preload) inform browser networking engines of critical domain handshakes and asset downloads before standard HTML parsing discovers them. #### Code Example.

20
SeniorCode#Routing#System Design

What is the Speculation Rules API and how does it enable 0ms navigations?

The modern browser standard replacing legacy prerendering.

21
SeniorCode#System Design

How does CSS `content-visibility: auto` cut render times?

```css .article-card { content-visibility: auto; contain-intrinsic-size: auto 350px; }.

22
SeniorCode#System Design

Measuring and Reporting RUM Web Vitals with the `web-vitals` Library.

The official Google web-vitals library hooks into PerformanceObserver APIs to calculate Core Web Vitals (LCP, INP, CLS) in production and dispatch telemetry to analytics backends. #### Code Example.

23
SeniorCode#System Design

Reducing Total Blocking Time (TBT) with Dynamic Imports.

Total Blocking Time (TBT): The lab proxy for INP • Dynamic Imports.

24
Senior#Forms#Docker & Containers

Modern Image Formats: AVIF vs. WebP vs. JPEG XL.

AVIF (AV1 Image File Format) • 50% smaller than JPEG, 20% smaller than WebP at identical visual quality • Supports HDR, wide color gamut (P3), and alpha transparency • WebP: Universally supported across all modern browsers.

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

26 Questions
25
Senior#System Design

Deep Dive into the INP Measurement Algorithm.

How Chrome computes your site's INP score: Every click, tap, and keypress interaction event (consisting of pointerdown, pointerup, click) is tracked as a group • The duration of an interaction is calculated as the time from the earliest event to when the next frame finishes painting.

26
Senior#Performance#Memory Management

Profiling Frontend Memory Leaks in Chrome DevTools.

Memory leaks cause browser tabs to consume gigabytes of RAM, triggering garbage collection thrashing that cripples INP: Three Snapshot Technique • Take Heap Snapshot 1 • Perform action (e.g. Open & Close Modal) • Take Heap Snapshot 2.

27
SeniorCode#System Design#HTTP & REST APIs

Analyzing LoAF (Long Animation Frames API) in Production.

Capturing actionable diagnostic data on slow scripts.

28
SeniorCode#System Design

Advanced Zero-CLS Font Metric Matching with `@font-face` Overrides.

When custom web fonts swap with system fallback fonts, line-wrapping changes because letter dimensions differ.

29
Senior#System Design

Third-Party Script Governance and Partytown.

Marketing scripts (GTM, Meta Pixel, Hotjar, HubSpot) execute hundreds of kilobytes of unoptimized JavaScript on the main thread: Partytown • Relocates third-party scripts to run inside a Web Worker • Proxies DOM and cookie access synchronously via Service Workers and Atomics.

30
Most AskedSeniorCode#Forms#Performance

High-Performance Caching: Stale-While-Revalidate and Edge CDNs.

```http Cache-Control: public, max-age=60, s-maxage=3600, stale-while-revalidate=86400.

31
Senior#System Design#HTTP & REST APIs

HTTP/3 & QUIC: Eliminating Head-of-Line Blocking for Web Vitals.

In HTTP/2 (over TCP): If a single network packet is lost, TCP stalls all multiplexed streams until the missing packet is retransmitted (TCP • In HTTP/3 (over UDP / QUIC): Each request stream is independent.

32
Most AskedSenior#System Design

Service Worker Caching Strategies for Instant LCP.

Using Workbox or native Service Workers: Cache-First (Stale-While-Revalidate) for Shell: HTML shell and core CSS are served directly from device storage in <10\text{ms} • Dynamic data is fetched and streamed concurrently • Result: LCP completes in under 300\text{ms} on repeat visits even on 2G connections.

33
Senior#System Design

Preventing Memory Bloat in Single Page Applications (SPAs).

In apps running for hours without full-page reloads: Always unsubscribe from RxJS observables or remove DOM event listeners in unmount lifecycle hooks • Avoid accumulating data indefinitely in client-side caches (e.g. Apollo Client, TanStack Query); enforce maximum cache age and garbage.

34
Most AskedSeniorCode#Forms#Performance

Real-World Performance Budgets in CI/CD.

Preventing regressions from entering production: Use Lighthouse CI (LHCI) in GitHub Actions.

35
Senior#Forms#Performance

Enterprise Web Performance Architecture: SRE for Frontend.

SLO Formulation: 95% of real-world page views must have LCP < 2.5\text{s}, INP < 200\text{ms}, and CLS < 0.1 • Alerting: PagerDuty alerts triggered if 7-day rolling CrUX P75 INP breaches 250ms.

36
Senior#System Design

Interaction to Next Paint (INP) Deep Dive: The 3 Phases of Interaction Latency.

Interaction to Next Paint (INP) replaced First Input Delay (FID) as Google's responsiveness Core Web Vital. While FID measured only the first interaction's input delay, INP measures the worst latency across all clicks, taps, and keypresses throughout the entire user session.

37
SeniorCode#System Design#HTTP & REST APIs

Long Animation Frames API (LoAF): Debugging Main Thread Freezes.

The Long Animation Frames API (LoAF) is the browser-native successor to the Long Tasks API. It reports frames that took longer than 50\text{ms} to render and provides exact attribution: Reports the specific script URL, function name, and character position that caused the lag.

38
SeniorCode#Routing#System Design

Speculative Rules API: Instant Page Navigations.

The Speculation Rules API allows pages to programmatically instruct the browser to pre-render full destination pages in a hidden background process before the user clicks a link: prerender: Fetches the HTML and executes JavaScript in the background • prefetch: Fetches the HTML response document into browser cache.

39
SeniorCode#System Design

Web Workers: Offloading Heavy Work from the Main Thread.

JavaScript is single-threaded; heavy tasks (CSV parsing, image compression, cryptographic hashing, vector search) freeze the main thread, spiking INP. Web Workers run scripts in a separate background thread with zero access to the DOM, communicating with the main thread via message passing (postMessage).

40
SeniorCode#Forms#Performance

Font Performance Optimization: `font-display: swap` and Size-Adjust.

Web fonts cause FOIT (Flash of Invisible Text) or FOUT (Flash of Unstyled Text) and trigger Cumulative Layout Shift (CLS): font-display: swap: Immediately displays system fallback font while the custom font downloads, ensuring fast First Contentful Paint.

41
Senior#System Design

Third-Party Script Sandboxing & The Facade Pattern.

Third-party widgets (Google Tag Manager, Intercom chat, YouTube embeds) account for up to 60% of main thread blocking time.: The Facade Pattern: Render a lightweight static image/button that mimics the interactive widget.

42
Senior#Forms#Performance

HTTP/3 and QUIC: Network Performance Advances.

HTTP/1.1: Subject to Head-of-Line (HoL) blocking on single TCP streams (requires 6 parallel connections) • HTTP/2: Multiplexes requests over 1 TCP connection, but a single lost packet blocks all multiplexed streams • HTTP/3 (QUIC): Runs over UDP.

43
Senior#System Design

Field Data (CrUX / RUM) vs Lab Data (Lighthouse).

Lab Data (Synthetic / Lighthouse): Tests a simulated page on a fixed machine with throttled CPU and network • Field Data (CrUX / RUM): Aggregated measurements from actual real-world users visiting the site across thousands of different mobile phones.

44
Most AskedSenior#System Design

Enterprise Cache-Control Header Strategies.

Static Hashed Assets (/static/app.a8f9c1.js) • Dynamic HTML Pages (/ or /sections).

45
Senior#System Design#HTTP & REST APIs

Early Hints (HTTP 103): Server Preloading Before HTML Delivery.

While a backend database query takes 200ms to compute the dynamic HTML page, the server can immediately send an HTTP 103 Early Hints response containing `` headers. The browser starts downloading critical CSS and fonts immediately instead of idling while waiting for the HTML document.

46
SeniorCode#Forms#Performance

Real User Monitoring (RUM) with `PerformanceObserver`.

Collect user-centric Core Web Vitals directly from users' browsers and beacon metrics back to observability endpoints.

47
Senior#System Design

DOM Virtualization & Windowing for 10,000+ Items.

Rendering 5,000 DOM nodes simultaneously consumes hundreds of megabytes of RAM and causes catastrophic style recalculation lag.

48
Senior#System Design#Data Structures

Modern JavaScript Bundle Splitting & Tree-Shaking.

Dynamic Route Splitting: Route components are split into distinct .js chunks loaded only when visited (() => import('./Page')) • ESM Tree-Shaking: Ensure libraries use ES module syntax (import { map } from 'lodash-es') rather than CommonJS (require('lodash')), enabling.

49
Most AskedSenior#System Design

Service Worker Caching Strategies.

Cache First: Serves from cache; falls back to network (ideal for immutable fonts and hashed images) • Network First: Attempts network; falls back to offline cache (ideal for live inventory or user balances).

50
Senior#System Design

Core Web Vitals and SEO: How Google Ranks User Experience.

Google integrates Core Web Vitals into its Page Experience ranking signal: Sites must pass the 75th percentile threshold across all three Core Web Vitals (LCP < 2.5\text{s}, INP < 200\text{ms}, CLS < 0.1) to earn the.