IntelliJ IDEA 2022.1 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.

    Compare snapshots 0
  2. In the right-hand part of the toolbar, click Compare With Baseline, then select the other snapshot.

    Compare snapshots

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

Compare snapshots method list

Let's look at the flame graph.

Compare snapshots 1

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

Compare snapshots frame
Last modified: 18 May 2022