Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method breakpoints may dramatically slow down debugging

Whenever adding a breakpoint to the line of a method declaration (in Intellij IDEA or Android Studio), a popup appears:

Method breakpoints may dramatically slow down debugging

Why would it dramatically slow down debugging, is my question? What is different about putting the breakpoint on the first line of the function?

Thanks!

like image 358
Jeeter Avatar asked Jun 25 '15 22:06

Jeeter


People also ask

Why are method breakpoints slow?

Method breakpoints will slow down debugger a lot because of the JVM design, they are expensive to evaluate. Remove method breakpoints and consider using the regular line breakpoints. To verify that you don't have any method breakpoints open .

What is method breakpoint?

Method breakpoints act in response to the program entering or exiting a particular method. They let you target your debugging sessions by method you wish to investigate, rather than by line number. Method breakpoints let you follow the program flow at the method level as well as check entry and exit conditions.

What do breakpoints do in debugging?

A breakpoint helps to speed up the debugging process in a large program by allowing the execution to continue up to a desired point before debugging begins. This is more efficient than stepping through the code on a line-by-line basis.

What is method breakpoint in Java?

A breakpoint is a signal that tells the debugger to temporarily suspend execution of your program at a certain point in the code. To define a breakpoint in your source code, right-click in the left margin in the Java editor and select Toggle Breakpoint. Alternatively, you can double-click on this position.


1 Answers

I looked around a little, and saw this post in the Intellij Documetation:

Method Breakpoint

Method breakpoints act in response to the program entering or exiting a particular method. They let you target your debugging sessions by method you wish to investigate, rather than by line number. Method breakpoints let you follow the program flow at the method level as well as check entry and exit conditions. Note that using method breakpoints can slow down the application you are debugging.

I guess it stops the program right before it enters the method, so that you can evaluate the parameters and such before entering the method.

The reason it dramatically slows down is (This is what I can gather, because that is all I could find on method breakpoints in Intellij's documentation) that it has to:

let you follow the program flow at the method level as well as check entry and exit conditions

and I suppose that would take a lot longer than just halting the program's execution

like image 140
Jeeter Avatar answered Sep 21 '22 01:09

Jeeter