Compare profiler snapshots
Last modified: 10 August 2022IntelliJ 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
Open the two snapshots that you are going to compare and select one of them.
In the right-hand part of the toolbar, click Compare With Baseline, then select the other snapshot.
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).

Let's look at the flame graph.

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

Thanks for your feedback!