Debugger performance problems usually come from one of two things. Some breakpoint types make the JVM report a very common event, which slows the whole program while it runs freely, including startup. Other settings only affect how fast the debugger inspects values while it is paused or stepping. The two groups have different fixes, so it helps to know which one you are hitting.
Quick check: is a breakpoint the cause?
If the slowdown appears during startup or while the program runs freely, not only when you step, first isolate a breakpoint:
- Toggle Mute Breakpoints in the Debug tool window and start the session again.
- If startup is fast with breakpoints muted, one of the breakpoint types below is responsible.
- Open Run | View Breakpoints (Ctrl+Shift+F8, or Cmd+Shift+F8 on macOS) to review and remove them.
Breakpoints that slow the whole program, including startup
These make the JVM fire an event on operations that happen constantly, so they slow code even while it runs freely, not just when you step.
- Field watchpoints (also called field breakpoints) ask the JVM to report every access or modification of a field. This has a global cost. It can turn off JIT optimizations and send field access through a slow path across the whole program, so a single watchpoint on a frequently used field can make startup many times slower. Even one you set earlier and forgot about is enough. Remove or disable watchpoints you no longer need. In Run | View Breakpoints they are grouped under Java Field Watchpoints.
-
Method breakpoints slow the debugger a lot. Because of the JVM design, they are expensive to evaluate. Remove method breakpoints and consider using regular line breakpoints instead. To confirm you have none, open the
.idea/workspace.xmlfile in the project root (or the<project>.iwsfile if you use the old project format) and look for entries in themethod_breakpointsnode. - Exception breakpoints set on Any exception, or a broad caught exception, fire every time an exception is thrown or caught. Frameworks such as Spring throw and catch many exceptions during startup, so this alone can add minutes. Restrict the exception breakpoint to a specific exception class, or disable it.
Settings that slow stepping and value inspection
These affect the debugger only while it is paused or stepping. They do not slow a freely running program, so they are not the cause of a slow startup.
- Show method return values is enabled in the Debug tool window. Try disabling it to improve performance.
- Enable alternative views for Collections classes and Enable toString() object view in Settings | Build, Execution, Deployment | Debugger | Data Views. If toString() methods take a long time to complete, disable this option. Note that custom toString() methods can also change the behavior of the application under the debugger if the code inside them changes the state of your application.
- Memory tab in the Debug tool window updates on every debugger stop. Minimize it to improve stepping performance.
- Settings | Build, Execution, Deployment | Debugger | Data Views | Editor | Show values inline. Disable to improve performance.
- Settings | Build, Execution, Deployment | Debugger | Data Views | Java | Predict condition values and exceptions based on data flow analysis. Disable to improve performance.
- Mute Renderers option in the Debug tool window Variables view context menu.
Comments
0 comments
Please sign in to leave a comment.