Wheezil
Wheezil

Reputation: 3462

Junit test debugged in netbeans is far slower than running without debug

I am having an issue running a junit test in netbeans 8.2. When simply run, it is something like 10x faster than when debugged. Both are done inside netbeans IDE. For example, a snippet of code to access CosmosDB using the MongoDB API:

MongoClientOptions.Builder builder = MongoClientOptions.builder();
builder.sslEnabled(mongodbSsl);

Will take about 20 seconds and consume a full CPU core while doing so. If I run with -verbose, I see 570 lines of classloader output during the second line of code, but that doesn't strike me as something that should take 20 seconds, nor does it explain the in-debugger time difference. Could it be exceptions caught-and-ignored hitting the IDE? Is there a way to get extra output explaining where the time is going? Unfortunately I don't know how to debug and profile at the same time.

Update: this issue does not occur in Eclipse.

Upvotes: 2

Views: 1149

Answers (1)

Wheezil
Wheezil

Reputation: 3462

As Corey mentioned, this was a case of breakpoints in Netbeans. Apparently, some cases of breakpoints are very expensive. In particular, Netbeans can have breakpoints that it fails to set (because they are on a line or method or class that is no longer valid). You can't see them, and so you cannot easily delete them either. You have to "clear all breakpoints". Then everything is back to normal.

Upvotes: 4

Related Questions