IntelliJ IDEA 2022.2 Help

Compare profiler snapshots

IntelliJ IDEA allows you to compare profiler snapshots. This may be useful to see how a certain change in the code affects performance, or how the same piece of code performs in different runtimes.

Open two snapshots for comparison

  1. Open the two snapshots that you are going to compare and select one of them.

    Two open tabs in the Profiler tool window
  2. In the right-hand part of the toolbar, click Compare With Baseline, then select the other snapshot.

    Selecting the baseline snapshot in the Compare With Baseline menu

For comparison, you can use the flame graph, the call tree, or the method list. In comparison mode, the tabs offer their regular functionality while additionally showing how the two snapshots differ in terms of each entry (for example, a tree node or a method list item).

Method List tab in the comparison mode

Let's look at the flame graph.

Flame graph in the comparison mode

If you see that half of the frame is green, it means that there were roughly 50% less samples with such state in the second snapshot. If an entire frame is green, it was not even present in the second snapshot. The red color means the opposite.

For example, the following part of the graph tells us that the main() method became 49.1% faster after the changes, and that this was mainly possible by reducing the time that the program spends in ArrayList.remove().

Hovering over a frame in the flame graph provides comparison details
Last modified: 06 September 2022