Sometimes your app works, but you want to increase performance by boosting its throughput or reducing latency. Other times, you just want to know how code behaves at runtime, determine where the hot spots are, or figure out how a framework operates under the hood.

Some of these details can be provided at design time, as IntelliJ IDEA provides you with all sorts of clues that can be produced statically. Of course, you cannot learn about all the bugs and inefficiencies by just looking at the code, because things get more complicated at runtime. Verifying any guesses you have can prove to be a tough task without the right tools at hand.

Two particularly helpful tools for examining the program at runtime are the debugger and profilers.

The debugger is very precise and gives you full and granular control over the execution of the program, which allows you to reproduce intricate failure conditions.

The profiler, on the other hand, offers a bird’s eye view of arbitrarily large execution chunks. It does not interfere with the running program, nor does it provide granular data like the debugger does. However, it can collect valuable information no other tool can, which is why in this post we are going to take a look at the capabilities of profilers.

IntelliJ IDEA provides integration with the following profilers:

Java Flight Recorder – a standard profiling tool shipped as part of the JDK.

Async profiler – a very accurate profiler that can also collect native call and memory allocation data.

Both of these profilers use sampling, so the overhead is very low – close to running the program without the profiler. You can attach either of them to a Java process and view the profiling report directly from IntelliJ IDEA.

#intellij-idea #programming #developer

Get Started With Profiling in IntelliJ IDEA
2.45 GEEK