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

Optimize CPU performance with Instruments
Learn how to optimize your app for Apple silicon with two new hardware-assisted tools in Instruments. We’ll start by covering how to profile your app, then dive deeper by showing every single function called with Processor Trace. We’ll also discuss how to use CPU Counters’ modes to analyze your code for CPU bottlenecks.

What’s new in Xcode 16
Discover the latest productivity and performance improvements in Xcode 16. Learn about enhancements to code completion, diagnostics, and Xcode Previews. Find out more about updates in builds and explore improvements in debugging and Instruments.

Improve memory usage and performance with Swift
Discover ways to improve the performance and memory management of your Swift code. We’ll explore ways to refine your code – from making high-level algorithmic changes to adopting the new InlineArray and Span types for finer control over memory and allocations.