Performance in debug mode (Java/IntelliJ)

I'd like to highlight two steps to avoid performance issues when using breakpoints.

Method/field breakpoints

  • Is your application noticeably slower in debug mode, even when not in a break point?
  • Did this problem start suddenly?
  • Do computation-heavy tasks take especially long (like password hashing)?

Then you may have some breakpoints that cost a lot of performance (why?).

  • Breakpoints on lines of code are fast
  • Breakpoints or fields and methods are slow
  • (Breakpoints on declarations/comments don't work)

In my experience, over 90% of the time, normal code line breakpoints are sufficient. Only in exceptional cases are method/field breakpoints worth the performance hit.

To remove all breakpoints, press ctrl+shift+A, type "remove all breakpoints", and press enter.

Step over

After reaching a breakpoint, you may step around in the code. And you may find that the 'step over' function is really slow, much slower than 'run to cursor' for the same code.

To make this faster, turn off 'show method return values' (see the attached image).

While this is several times faster, it doesn't make it quite as fast as 'run to cursor', or just running to the next breakpoint.

If that doesn't work

JetBrains also has some recommendations like changing object view and limiting the memory tab. Have a look!.

Having an extreme amount of watched expression is also something to avoid.


Topics: #coding #java #performance #ide


No comments yet

You need to be logged in to comment.