What is flame graph

Asked on 06/16/2025

1 search

A flame graph is a graphical representation used to visualize function costs and relationships in a program's execution. It is particularly useful for performance analysis. The width of the bars in a flame graph represents the amount of time a function took to execute, while the rows represent nested call stacks. This visualization helps in identifying which parts of the code are consuming the most resources and can be optimized.

Flame graphs are often used in conjunction with tools like Instruments in Xcode to provide a high-level overview of trace execution, allowing developers to spot performance issues at a glance. They are particularly useful for analyzing how work is distributed over time or which threads are active simultaneously.

For example, in the session "Optimize CPU performance with Instruments" from WWDC 2025, flame graphs are used to show execution visually, with different colors representing different types of binaries, such as system frameworks, the Swift runtime, and custom app code. This helps developers understand the exact calls made over time as they would have been executed on the CPU.

You can learn more about flame graphs in the session Optimize CPU performance with Instruments (16:36).