Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 201387 - Java Debugger Conditional Breakpoint Performance
Java Debugger Conditional Breakpoint Performance
Status: NEW
Product: debugger
Classification: Unclassified
Component: Java
7.0.1
PC Windows 7 x64
: P3 with 1 vote (vote)
: 7.2
Assigned To: Martin Entlicher
issues@debugger
: PERFORMANCE
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-28 15:15 UTC by rhollencamp
Modified: 2013-02-24 16:33 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Overview of memory utilization during debugging (166.27 KB, image/png)
2011-08-28 15:15 UTC, rhollencamp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rhollencamp 2011-08-28 15:15:52 UTC
Created attachment 110260 [details]
Overview of memory utilization during debugging

Conditional breakpoint performance when debugging a Java app is terrible. Test case:


	public static void main(String[] args) {
		for (int i = 0; i < 50000; i++) {
			doWork(i);
		}
	}

	private static void doWork(int i) {
		return;
	}



Place a breakpoint on the call to doWork, and set a condition on the breakpoint: i == 49000. Start debugging. On my machine it takes over two minutes to hit the breakpoint. Looking at the memory utilization using VisualVM, Netbeans is thrashing pretty hard, creating all kinds of objects that are then garbage collected.

Workaround that I use is to put a block of code before the call to doWork:
if (i == 49000) {
        System.out.println("foo");
}

I then place a breakpoint on the println; the breakpoint is reached almost instantly.
Comment 1 Martin Entlicher 2011-09-05 16:03:05 UTC
The problem is that the breakpoint condition is evaluated on the client side. The breakpoint breaks execution every time, the condition is evaluated and when it's false, the execution is resumed again. This makes the conditional breakpoints very slow.

I do not think that there is a way how to reliably execute conditions from the breakpoint location on the server side.

We can try to evaluate possible approaches for the next release.
Comment 2 peathal 2013-02-24 16:33:01 UTC
Same problem here for NetBeans 7.3.

A simple workaround is to put the if statement directly in the code and an unconditional breakpoint inside the if. Couldn't one do similar for the implementation? Why is the debugging 'server' limited in this way and the debugging client not?


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo