Lesson 1.3

Reading a flame graph

In a flame graph each bar is a function call: how wide it is tells you how long it ran, and what sits beneath it tells you what it called.

19mAdvanced8.4k students

Overview

Width is time, depth is who called whom

In a flame graph each bar is a function call: how wide it is tells you how long it ran, and what sits beneath it tells you what it called. Wide bars are your targets; deep stacks are just structure.

Anything over fifty milliseconds on the main thread is a long task, and long tasks are what make an interface feel unresponsive — during one, the browser cannot respond to input at all.

Check what kind of work the bar represents before optimising it. Time spent in layout and paint is not fixed by memoising a component; that is a CSS or DOM-size problem wearing a React costume.

In this lesson you will:

  • Read width as time and depth as call stack
  • Spot long tasks that block the main thread
  • Separate script time from layout and paint

Resources

Previous Lesson
Next Lesson
Reading a flame graph — React Performance Engineering — Vertex