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 244903 - Performance problems while debugging real Nashorn applications
Summary: Performance problems while debugging real Nashorn applications
Status: RESOLVED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.0
Hardware: PC Linux
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords: PERFORMANCE
Depends on: 246412
Blocks:
  Show dependency tree
 
Reported: 2014-06-05 10:07 UTC by Jaroslav Tulach
Modified: 2014-08-12 17:40 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ClassCastException (139.11 KB, image/png)
2014-06-20 17:12 UTC, Martin Entlicher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2014-06-05 10:07:30 UTC
It is slightly hard to describe all the problems I have seen (like issue 244902), but I believe they are real. To give everyone a chance to enjoy the say problems, I describe what is the debugging task. The hope is that while one tries to debug the problem, one will see the issues itself. Please don't cheat and don't you any debug messages - ideally using debugger should be enough, right?

Set the project up:

$ hg clone http://source.apidesign.org/hg/html~html4j/ 
$ cd html~html4j 
$ hg up -C e2eede6131fd
$ mvn clean install 

I am running on JDK8b132 and the above command fails while executing tests in boot-script module.

The task is: Find out why "displayContentOfArray" test fails. 

Hints: 
- open boot-script in NetBeans
- open KnockoutEnvJSTest in editor
- run the test file (Ctrl-F6), verify there are test failures
- debug the file (Ctrl-Shift-F6) and find what is the problem

Please treat this as umbrella and create subissues for anything you find blocking on your quest to find out what is wrong. Just to name few things I have seen: magnificently slow when in debug mode, evaluation of local variables takes enormous amount of time, expression evaluation gives wrong results, adding/removing breakpoints during debugging session has not effect; only after restart, run to cursor does not stop, etc.
Comment 1 Martin Entlicher 2014-06-20 17:07:36 UTC
I've reproduced the worse performance under the debugger.
It seems that this is due to a creation of a map of scripts to appropriate class files. Each time a class compiled from a script is loaded, debugger pauses the execution, finds the script's URL and checks if there exist some breakpoints for this script. If there's a large number of scripts, this slows the start of the program down. I'm not aware of a more performant solution so far.

The bad performance during stepping in JavaScript code seems to be caused by a huge number of variables that are displayed in Variables window. This is something that needs to be explored in more details. 

The test keeps failing with ClassCastException. But it's hard to step to the code that throws this error. :-(
I'm going to attach a screenshot with the stack trace...
Comment 2 Martin Entlicher 2014-06-20 17:12:24 UTC
Created attachment 147731 [details]
ClassCastException

I stepped here via a step into from Knockout.allocJS(). I'm not sure how this native method is implemented, but it looks like the script executed correctly (I was able to step through the script which assigns 128 objects to an array and the arr had the proper value).
Comment 3 Martin Entlicher 2014-06-20 17:15:44 UTC
I did not encounter wrong results from expression evaluations, nor had I problems with breakpoints. Even breakpoints in <eval>.js work correctly for me.
(I was using JDK 1.8.0_20-ea-b17 with trunk NetBeans).
Comment 4 Martin Entlicher 2014-07-29 14:41:56 UTC
The performance is improved by
http://hg.netbeans.org/core-main/rev/2c684310cc24
and
http://hg.netbeans.org/core-main/rev/14a5602f7408

We use binding of class and source in Context class.
Comment 5 Quality Engineering 2014-07-31 08:57:02 UTC
Integrated into 'main-silver', will be available in build *201407310738* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2c684310cc24
User: mentlicher@netbeans.org
Log: #244903: More specific method breakpoints improve performance.