This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 186517

Summary: Make stepping as fast as possible.
Product: debugger Reporter: Martin Entlicher <mentlicher>
Component: JavaAssignee: Martin Entlicher <mentlicher>
Status: RESOLVED FIXED    
Severity: normal CC: jtulach
Priority: P2 Keywords: PERFORMANCE, USABILITY
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 157767, 190080    
Bug Blocks:    

Description Martin Entlicher 2010-05-21 15:13:30 UTC
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.
Comment 1 Martin Entlicher 2010-05-21 15:18:03 UTC
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.
Comment 2 Martin Entlicher 2010-08-12 15:56:44 UTC
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.
Comment 3 Martin Entlicher 2010-08-17 14:48:22 UTC
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.
Comment 4 Martin Entlicher 2010-08-17 16:18:33 UTC
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.
Comment 5 Martin Entlicher 2010-08-19 17:02:13 UTC
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.
Comment 6 Martin Entlicher 2010-08-20 13:24:49 UTC
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
Comment 7 Quality Engineering 2010-08-21 03:42:47 UTC
Integrated into 'main-golden', will be available in build *201008210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/85411ba726c4
User: mentlicher@netbeans.org
Log: #186517 Change the test of thread stack depth to improve performance.
Comment 8 Martin Entlicher 2010-09-06 09:49:41 UTC
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
Comment 9 Martin Entlicher 2010-09-14 15:50:08 UTC
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
http://hg.netbeans.org/main/rev/762b245da2cb
Comment 10 Quality Engineering 2010-09-15 03:06:12 UTC
Integrated into 'main-golden', will be available in build *201009150000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/762b245da2cb
User: mentlicher@netbeans.org
Log: #186517 Implemented blocking of evaluations in Variables and Watches view when debugger actions are pending. This speeds up consecutive stepping.