Course contentsShow
← Web Development
Lesson 2069 of 2,98238. JavaScript Performance in the BrowserFree lesson

Identifying Long Tasks in DevTools

Using Chrome's Performance panel to find and analyze long tasks in the flame chart and bottom-up view.

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

  1. Flame Chart (default view): Shows chronological execution. Follow the tallest "flames" to find nested function calls. The wider the bar, the longer it ran.

  2. 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.