Stepping in a program that is being debugged should be nearly as fast as JDI step events are.
Currently the repeated stepping is slowed down by views that load various additional information based on the location where individual steps finish. Debugging view display the stack frames and Variables/Watches view calculates values of variables/watches. As the number of evaluated variables and invoked methods grows, steps are slower, because they wait for the evaluations to complete.
The solution is to cancel variable refreshing as soon as a next step is issued.
This will allow the next step to be immediately executed. It still need to wait till a current method invocation completes (if any), but any other scheduled method invocation should be canceled.
The action providers need to cancel the variables refreshing which is being performed in debugger's request processor. This needs to be done before doLazyAction() call, because the action itself is run in an RP that is occupied by variables refreshing tasks.
Not only variable refreshing needs to be canceled.
Retrieval of the call stack and retrieval of location information of every stack frame also takes time. This information is used for annotation in Editor and display in Debugging view.
ReferenceType.locationsOfLine() which is used in Step Into is inefficient. It iterates through all methods in the type and retrieves their line number table. The time it takes is proportional to the number of methods.
Actions Make Caller Current and Make Callee Current are inefficient as well, they retrieve the whole call stack. This is not really necessary.
DebuggingTreeModel should not recompute children if the Debugging view is not visible.
Some changes that improve the stepping performance in general were applied:
Change the test of thread stack depth to improve performance
changeset: 175972:85411ba726c4, http://hg.netbeans.org/main/rev/85411ba726c4
When comparing stack frames, compare just their locations
changeset: 175973:3edc6280cb9e, http://hg.netbeans.org/main/rev/3edc6280cb9e
Search for line locations in a concrete method, rather then the whole class type. Do not use ReferenceType.locationsOfLine()
changeset: 175974:67180d322efb, http://hg.netbeans.org/main/rev/67180d322efb
Do not retrieve the whole stack trace when just checking the stack depth in Make Caller Current and Make Callee Current actions
changeset: 175976:c6b072704378, http://hg.netbeans.org/main/rev/c6b072704378
Detach listeners when the Debugging view is not visible so that the children are not being refreshed
changeset: 175977:1268e3f00b17, http://hg.netbeans.org/main/rev/1268e3f00b17
Load call stack frames with a delay to improve performance
changeset: 175978:b9ec58f671f2, http://hg.netbeans.org/main/rev/b9ec58f671f2
Integrated into 'main-golden', will be available in build *201008210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: #186517 Change the test of thread stack depth to improve performance.
The variable models should cancel evaluations as soon as the step is scheduled. This can be made as a model filter. Therefore adding dependency on issues #190080 and #157767
Variables refreshing is canceled as soon as a step action is scheduled. This should allow the step to be executed as soon as possible. Implemented in changeset: 177448:762b245da2cb
Integrated into 'main-golden', will be available in build *201009150000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: #186517 Implemented blocking of evaluations in Variables and Watches view when debugger actions are pending. This speeds up consecutive stepping.