Web performance: Core Web Vitals, loading and runtime speed – Front End interview prep
261 interview-style multiple-choice questions on Web performance: Core Web Vitals, loading and runtime speed, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 52 key terms with the flashcards first, then test yourself.
Take the practice test · Flashcards · All study tools
What it covers
- 10.1 Core Web Vitals and performance metrics
- 10.2 Optimizing Largest Contentful Paint
- 10.3 Preventing layout shifts (CLS)
- 10.4 Interaction responsiveness and INP
- 10.5 JavaScript cost: bundles, splitting and third parties
- 10.6 Images, video and fonts
- 10.7 Network delivery, compression and caching
- 10.8 Runtime performance, memory and animation
- 10.9 Measuring, monitoring and performance budgets
Key terms
10.1 Core Web Vitals and performance metrics
- LCP
- Largest Contentful Paint: when the main content becomes visible
- INP
- Interaction to Next Paint: responsiveness to user input
- CLS
- Cumulative Layout Shift: visual stability
- TTFB
- Time to First Byte: how fast the server starts responding
- FCP
- First Contentful Paint: first text or image painted
- TBT
- Total Blocking Time: blocking past 50 ms per long task
- CrUX
- Chrome UX Report of real-user metrics
- Soft navigation
- SPA route change without a full load
10.2 Optimizing Largest Contentful Paint
- Resource load delay
- TTFB to LCP resource start
- Render delay
- LCP resource loaded to painted
- Image CDN
- Service resizing and converting images
- Edge rendering
- Generating HTML on servers near users
10.3 Preventing layout shifts (CLS)
- Layout shift regions
- DevTools overlay showing shifts
- Layout Instability API
- Reports layout-shift entries
- Facade
- Lightweight stand-in for a heavy embed
- font-display: optional
- Use web font only if ready at once
10.4 Interaction responsiveness and INP
- Input delay
- Wait before handlers run
- Presentation delay
- Handlers done to next paint
- Rage click
- Rapid repeated clicks from frustration
- Partial hydration
- Hydrating only the interactive parts
10.5 JavaScript cost: bundles, splitting and third parties
- Hydration payload
- Serialized data in HTML for hydration
- Barrel file
- Module re-exporting many others
- JS execution time
- Parse, compile and run time per script
- Dependency audit
- Reviewing npm packages for weight and risk
10.6 Images, video and fonts
- AVIF
- Modern image format with strong compression
- Font subsetting
- Removing unused glyphs
- FOIT
- Flash of invisible text
- Save-Data
- Client hint asking for lighter pages
10.7 Network delivery, compression and caching
- Code splitting
- Breaking JavaScript into chunks loaded on demand
- Tree shaking
- Removing unused exports from bundles
- CDN
- Content delivery network: servers near users that cache content
- fetchpriority
- Attribute hinting how important a resource is
- Brotli
- Compression format better than gzip for text
- Cache hit ratio
- Share of requests served from cache
- Origin shield
- Cache tier in front of the origin
- Server-Timing
- Header exposing back-end timings
10.8 Runtime performance, memory and animation
- Long task
- Main-thread work longer than 50 ms
- Debounce
- Run once after activity stops for a set time
- Throttle
- Run at most once per interval
- Virtualization
- Rendering only the visible part of a long list
- Web Animations API
- element.animate() from JavaScript
- Frame rendering stats
- DevTools overlay of FPS and dropped frames
- GC pause
- Garbage collection stalling the main thread
- Unbounded cache
- Cache that never evicts
10.9 Measuring, monitoring and performance budgets
- Lighthouse
- Automated auditing tool for performance and quality
- Performance budget
- A limit on metrics or sizes enforced during development
- RUM
- Real User Monitoring: metrics collected from real visitors
- User Timing API
- performance.mark and performance.measure for custom timings
- PageSpeed Insights
- Field CrUX plus Lighthouse lab run
- WebPageTest
- Detailed lab testing from real locations
- Navigation Timing
- API for the page's own load timings
- Lighthouse CI
- Lighthouse on every change
Sample practice questions
What does Largest Contentful Paint (LCP) measure?
- How long until all JavaScript has finished running
- The total time to download every resource on the page
- When the largest visible image or text block is rendered
- How long until the first byte arrives from the server
Answer: C. When the largest visible image or text block is rendered "Good" LCP is 2.5 seconds or less at the 75th percentile of page loads.
The LCP element is a hero image referenced only from a CSS background. What helps most?
- Lazy-load it with `loading="lazy"` so it doesn't compete
- Move all the CSS to the end of the body so HTML parses first
- Put it in an `<img>` or preload it, with `fetchpriority="high"`
- Convert it to a GIF so it starts showing frames sooner
Answer: C. Put it in an `<img>` or preload it, with `fetchpriority="high"` The browser can't find a CSS background image until it has parsed the CSS and built the render tree.
An image without width and height attributes loads and pushes the text below it down. Which metric suffers most?
- CLS
- TTFB
- LCP
- INP
Answer: A. CLS Set `width`/`height` or `aspect-ratio` so the browser reserves space before the image arrives.
A button click runs a 400 ms synchronous loop before the UI updates. Which metric suffers most?
- LCP
- INP
- TTFB
- CLS
Answer: B. INP Long tasks on the main thread delay the next paint after an interaction.
What does code splitting do for a single-page app?
- Moves all of the JavaScript inline into the HTML file
- Splits each source file into two smaller files at build time
- Splits the bundle so each route loads only the code it needs
- Duplicates code across bundles to avoid extra requests
Answer: C. Splits the bundle so each route loads only the code it needs Smaller initial JavaScript means faster parsing and interactivity.
Which image format usually gives the smallest files for photos with broad browser support today?
- AVIF or WebP
- GIF or SVG
- PNG or APNG
- BMP or TIFF
Answer: A. AVIF or WebP Serve them with `<picture>` and fall back to JPEG when needed.
What does Brotli or gzip compression on text responses do?
- Converts every image in the response to WebP
- Combines all the site's files into a single download
- Minifies the variable names inside JavaScript files
- Shrinks HTML, CSS and JS on the wire; the browser decompresses
Answer: D. Shrinks HTML, CSS and JS on the wire; the browser decompresses Already-compressed formats like JPEG gain little from it.
What does list virtualization (windowing) do?
- Moves the list into a separate browser tab
- Renders only the visible rows plus a small buffer
- Caches each rendered row as a static image
- Loads the list's data from a virtual machine
Answer: B. Renders only the visible rows plus a small buffer Fewer DOM nodes means faster rendering and less memory.
What is the difference between lab data and field data?
- Lab: a controlled test like Lighthouse; field: real users' visits
- They're two names for the same set of measurements
- Lab data is always more accurate, so field data is rarely used
- Field data comes from the developer's own machine and network
Answer: A. Lab: a controlled test like Lighthouse; field: real users' visits Core Web Vitals assessments use field data (such as the Chrome UX Report); lab data helps you debug.
Which metric replaced First Input Delay (FID) as a Core Web Vital in 2024?
- First Contentful Paint (FCP)
- Interaction to Next Paint (INP)
- Total Blocking Time (TBT)
- Time to First Byte (TTFB)
Answer: B. Interaction to Next Paint (INP) INP looks at the latency of interactions across the whole visit, not just the first one.
More Front End
- HTML semantics & accessibility
- CSS: box model, Flexbox, Grid
- JavaScript fundamentals
- Async JavaScript & the event loop
- TypeScript
- React: components, hooks & rendering
- State management: Redux, Zustand, context
- Angular and Vue basics
- Browser internals & rendering
- Build tools & bundlers
- Front-end testing
- Front-end security
- Mobile & cross-platform