How do you identify performance bottlenecks?
PerformanceThe short answer
Use browser DevTools to measure, not guess. The Performance tab shows where time is spent (JavaScript, layout, paint). The Network tab reveals slow or large requests. Lighthouse gives an overall score with specific recommendations. React DevTools Profiler shows which components re-render unnecessarily. Always measure first, then optimize.
Step 1: Measure with Lighthouse
Run a Lighthouse audit to get a high-level picture:
- Performance score
- Largest Contentful Paint (LCP) — is the main content loading fast?
- Total Blocking Time (TBT) — is JavaScript blocking the main thread?
- Cumulative Layout Shift (CLS) — is the page visually stable?
Lighthouse gives you specific recommendations like "remove unused JavaScript" or "serve images in modern formats."
Step 2: Profile with the Performance tab
Record a session in Chrome DevTools Performance tab:
- Click Record, interact with the page, click Stop
- Look at the flame chart — tall stacks mean deep call chains, wide bars mean slow functions
- Check the Summary — how much time is spent in Scripting, Rendering, Painting
- Look for long tasks (blocks over 50ms that block the main thread)
Step 3: Check the Network tab
Look for:
- Large files that could be smaller (uncompressed images, unminified JS)
- Many sequential requests (waterfall pattern) — should they run in parallel?
- Slow API responses — is the server the bottleneck?
- Requests without caching headers
Step 4: Profile React with React DevTools
The Profiler tab shows:
- Which components rendered and how long each took
- Why a component re-rendered (props changed, state changed, parent re-rendered)
- Which renders were unnecessary
Common bottlenecks and fixes
| Bottleneck | How to find it | Fix |
|---|---|---|
| Large JS bundle | Network tab, Lighthouse | Code splitting, tree shaking |
| Unoptimized images | Network tab | WebP/AVIF, lazy loading, srcset |
| Unnecessary re-renders | React Profiler | React.memo, useMemo, useCallback |
| Layout thrashing | Performance tab (purple bars) | Batch DOM reads/writes |
| Slow API | Network tab | Caching, pagination, CDN |
| Render-blocking CSS/JS | Lighthouse | defer/async, critical CSS |
The process
- Measure — get a baseline with Lighthouse and the Performance tab
- Identify — find the biggest bottleneck (not the easiest to fix)
- Fix — apply the targeted optimization
- Measure again — confirm the fix actually improved things
- Repeat — tackle the next biggest bottleneck
Interview Tip
Describe a systematic approach: measure with tools, identify the bottleneck, fix it, measure again. Name the specific tools (Lighthouse, Performance tab, React Profiler). The table of common bottlenecks and fixes is a great way to show breadth of knowledge. Saying "I always measure before optimizing" shows maturity.
Why interviewers ask this
Performance optimization without measurement is just guessing. Interviewers want to see if you have a systematic approach to finding and fixing performance issues. A candidate who can walk through the tools and process shows they have done this in real projects.