Frontend Developer interview question
How do you improve web performance?
Improve performance by measuring the user journey first: identify the largest contentful paint, blocking JS, slow network requests, layout shifts, and unnecessary rendering. Optimise the bottleneck rather than applying random memoisation.
Direct answer
What a strong answer covers
How it works
Performance work starts from a measurement of what users experience: Largest Contentful Paint, Interaction to Next Paint, and Cumulative Layout Shift from field data, then a lab trace to find the cause. The usual culprits are render-blocking scripts and stylesheets, oversized or late-discovered images, long main-thread tasks, and layout shifts from content without reserved space. Each fix is verified against the same metric, because a change that shrinks a bundle may not move LCP at all.
Example
If the LCP image is late, preload and correctly size it before optimising a small component render that is not on the critical path. A dashboard whose INP was poor turned out to run a 300 ms synchronous filter on each keystroke; debouncing the input and moving the filter into a worker fixed it without touching bundle size.
Common mistakes
- Optimising bundle size when the bottleneck is a slow API response.
- Lazy-loading the hero image and delaying the very element LCP measures.
- Reporting lab scores from a fast laptop instead of field data from real devices.
A useful answer structure
Answer from your own work.
Do not memorise a script: use only examples you can explain honestly in follow-up questions.
Open the desktop workspace and rehearse a clear answer in your own words.