Performance in debugger using Step Over vs. Resume Program Execution?
For as many versions of IDEA as I can remember, I have had an ongoing issue that has bothered me. The problem is that performance in response to Step Over vs. Resume Program Execution is drastically different.
Imagine I have two lines of code in the middle of a method somewhere:
...
Set<Things> things = fetchThings();
System.out.println("Number of things: " + things.size);
...
If I put a breakpoint before each of these lines and debug the program, when the program stops on the first line, I have two choices to move the program pointer to the next line, I can either click on "Step Over" or "Resume Program Execution". Both will then execute the first line and stop at the second line. Using the Resume Program Execution seems to perform the first line at expected speeds. However, if I do "Step Over" it takes much longer.
I just tried a trivial example in a piece of our code where I know I am going to fetch 10 rows of data out of a db. "Resume Program Execution" returns immediately and "Step Over" takes about 3-5 seconds. When a query is much more substantial, the difference is very pronounced.
So, for years, I have found that I have to continually set multiple breakpoints, one before and one after the code I am debugging so I can use the "Resume Program Execution" to step over db access code in a reasonable amount of time.
Has anoyone else experienced this?
Anyone know why this happens?
Please sign in to leave a comment.
I've noticed this too - and it's been happening for so long that these days
I just take it for granted and like you I often set two adjacent breakpoints
almost without thinking :) I've always put it down to a problem with the
JVM rather than IDEA, something like the poor performance experienced with
method breakpoints. No idea if that's actually true or not though. If a fix
could be implemented in IDEA (perhaps by doing the two-breakpoint trick behind
the scenes?) that would be great.
Chris
EB> For as many versions of IDEA as I can remember, I have had an
EB> ongoing issue that has bothered me. The problem is that performance
EB> in response to Step Over vs. Resume Program Execution is drastically
EB> different.
EB>
EB> Imagine I have two lines of code in the middle of a method
EB> somewhere:
EB>
EB> ..
EB> Set http://www.jetbrains.net/devnet/message/5255965#5255965
Chris,
Thanks for the verification. It is good to know it has not just been me all this time. Your guess as to what is going on is as good as any. It would be nice if someone actually knows why, and even better if there is a fix
I've been experiencing this issue for so long that I doubt it ever worked as expected, but it is really annoying.
Although I've found this behavior reported and resolved as won't fix here http://youtrack.jetbrains.net/issue/IDEA-27221 I really think there is a way to workaround this.
For example why not to implement action which would automatically set breakpoint on next line and resume program instead of doing real jdwp stepover.
I see there is a "Force Step Over" action working in a similar manner, which I never used though.
Maybe we should go and vote for that issue?
Thanks,
Oleg.