Trace Frontend Performance Issues in DevTools
In this article
This guide shows you how to use browser developer tools to find and fix frontend performance problems like slow page loads, janky scrolling, and unresponsive interactions. You'll learn to read the Network, Performance, and Memory panels to pinpoint bottlenecks and verify your fixes.
What You'll Need
- A modern browser (Chrome, Edge, Firefox, or Safari) with built-in developer tools.
- A page or app that exhibits the performance issue you want to trace.
- Basic familiarity with opening DevTools (F12 or Ctrl+Shift+I on Windows/Linux, Cmd+Option+I on Mac).
Step-by-Step
- Open DevTools and go to the Network panel. Start by recording network activity. Reload the page to capture all requests. Look for the big red or orange bars in the waterfall — these are slow requests. Sort by size or time to find the largest files (images, scripts, fonts) that delay the load.
- Check the Performance panel for load bottlenecks. Go to the Performance panel, click the record button (or press Ctrl+E), then reload the page. Stop recording after the page finishes loading. The resulting timeline shows a breakdown of scripting, rendering, and painting. Look for long yellow (scripting) or purple (rendering) blocks that dominate the timeline.
- Analyze the Performance summary. The summary at the top shows percentages for each category. If scripting is high, your JavaScript is the culprit. If rendering or painting is high, your CSS or layout is the problem. Click on the largest block to see the call stack of what function was running.
- Use the Performance panel's "Main" section to find long tasks. Scroll through the main thread timeline. Tasks that take more than 50ms are considered long and can block user input. Click a long task to see its duration and the function that caused it. This is often a synchronous loop, a heavy DOM manipulation, or a forced reflow.
- Check for layout thrashing in the Rendering tab. In the Performance panel, enable the "Rendering" checkbox in the bottom toolbar. This highlights areas that are being repainted. If you see large red rectangles during scrolling, your page is repainting too much — likely due to animations or frequent style changes.
- Profile JavaScript with the Memory panel. If the page gets slower over time or uses too much memory, go to the Memory panel. Take a heap snapshot, interact with the page, then take another snapshot. Use the comparison view to see what objects are being retained. Look for detached DOM nodes or large arrays that are never garbage-collected.
- Use the Coverage tool to find unused code. In the Coverage panel (sometimes under More tools), click the record button and reload. It shows which lines of CSS and JavaScript are actually used. Red lines are unused code you can remove or load lazily.
- Verify your fix by repeating the measurement. After making a change, go back to the Performance panel and record again. Compare the new timings and long-task counts with the baseline. A fix that doesn't improve the numbers isn't a fix.
Common Mistakes
- Testing on a fast machine with a fast connection. Performance issues often only appear on slower hardware or throttled networks. Use DevTools' network throttling (e.g., "Slow 3G") and CPU throttling (in the Performance panel) to simulate real-world conditions.
- Ignoring the difference between load and runtime performance. A page can load fast but still jank when scrolling. Always test both: load time via Network, and interaction via Performance.
- Assuming the biggest file is the problem. A large image may load in parallel, while a small JavaScript file might block rendering because it's in the head. Look at the waterfall order, not just size.
- Forgetting to disable browser extensions. Extensions can inject code that slows down your page. Test in an incognito window or with extensions disabled to get a clean baseline.
- Making changes without measuring again. Always compare before and after. Without a baseline, you can't tell if your change helped or hurt.
Tips
- Use the Performance panel's "Screenshots" checkbox to see visual frames alongside the timeline — this helps correlate jank with specific animations.
- In the Network panel, right-click a request and select "Copy as cURL" to replay it in a terminal for further testing.
- Use the "Lighthouse" panel (or tab) for an automated audit. It gives a score and specific recommendations, but always verify with manual profiling.
- Learn to read the color coding in the Performance timeline: yellow for scripting, purple for rendering, green for painting, gray for system.
- For React or Vue apps, use the React DevTools or Vue DevTools profiler to see component-level re-renders — this often reveals unnecessary updates.
Troubleshooting
If you can't reproduce the issue in DevTools, try these steps:
- Clear the cache and disable service workers. Service workers can serve stale assets. In the Network panel, check "Disable cache" and in the Application panel, unregister any service workers.
- Check if the issue is caused by third-party scripts. Temporarily block scripts from domains like Google Analytics or ad networks using the Network panel's blocking feature (right-click a domain and select "Block request domain"). If the issue disappears, the third-party script is the culprit.
- Test in a different browser. Some issues are browser-specific. If the problem only occurs in one browser, it might be a rendering engine bug or a browser extension.
- Use the Console panel for errors. JavaScript errors can halt execution and cause performance issues. Look for red errors and fix them first.
- If the Performance panel shows a long task but no obvious function, enable the "JS Profiler" checkbox (in the Performance panel's settings) to get a more detailed function-level breakdown.
Frequently Asked Questions
What is a "long task" and why does it matter?
A long task is any task that takes more than 50ms on the main thread. It blocks user input, so the page feels unresponsive. The Performance panel highlights these tasks in red.
Should I optimize for load time or runtime performance?
Both, but prioritize what your users complain about. If the page takes 5 seconds to load, fix that first. If it loads fast but stutters when scrolling, focus on runtime.
How do I find which image is slowing down my page?
In the Network panel, sort by "Size" or "Time". The largest or slowest image is usually the culprit. You can also filter by "Img" to see only image requests.
What does "forced reflow" mean?
It's when JavaScript reads a layout property (like offsetWidth) after making a style change, forcing the browser to recalculate layout synchronously. This can cause jank if done repeatedly. The Performance panel shows "Recalculate Style" events that indicate this.
Why does my page use so much memory?
Likely due to event listeners that are never removed, detached DOM nodes, or large data structures kept in global variables. Use the Memory panel's heap snapshots to identify what's retaining memory.
Is it enough to use Lighthouse for performance testing?
Lighthouse is a good starting point, but it gives a synthetic score. Real-world performance can differ. Always combine Lighthouse with manual profiling in the Performance panel to see actual user impact.