Identifying Long Tasks in DevTools
You'll learn how to use Chrome DevTools to visually spot and analyze long tasks that freeze your UI.
The Visual Detective Work
You know long tasks exist and block interactivity, but where are they hiding in your code? Chrome's Performance panel turns abstract timing data into visual evidence you can act on. Think of it like watching a security camera recording to find exactly when and where something went wrong.
Recording and Finding Long Tasks
Open Chrome DevTools (F12), switch to the Performance tab, and click the record button while interacting with your page. Stop recording, and you'll see a flame chart—a colorful timeline showing everything your browser did.
Long tasks appear as yellow bars in the "Main" thread section. If a single bar stretches beyond 50ms, that's your culprit. Hover over it to see the exact duration. The flame chart stacks function calls vertically, so you can see which specific function ate up the time.
Two Views for Analysis
-
Flame Chart (default view): Shows chronological execution. Follow the tallest "flames" to find nested function calls. The wider the bar, the longer it ran.
-
Bottom-Up tab (below the chart): Groups time by function name, showing which functions consumed the most total time across your recording. Sort by "Self Time" to find functions doing actual work vs. just calling other functions.
Look for entries labeled "(anonymous)" or specific function names with high self-time—these are your optimization targets.
Key Takeaway: Chrome's Performance panel transforms long task detection from guesswork into visual analysis—use the flame chart to see when tasks block the main thread and the bottom-up view to see which functions are responsible.