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.
The creating model from source has two main phases: Parsing and building model. Parsing is done in Nashorn and we can not influence it much. The building model has two parsts: creating objects from AST and resolving types of assignments, return types etc. I have noticed that the resolving types is very slow for big files. For example for the file ext-4.0.7-gpl/examples/portal/classes.js (from Ext Js library) it takes whole parsing cycle more then about 9 seconds. Parsing in Nashor - 1 200 ms, creating objects from AST - 1 127ms and resolving types 5 890 ms. So the part of resolving types is the most slow.
The root of the problem is in the recursion that is used in ModelUtils.getDeclarationScope(Declaration scope, int offset). When the recursion I have replaced with new cycle the result time is about 3 second smaller. Parsing in Nashorn - 1200ms, creating object from AST - 630 ms and resolving types 1 400ms. This means that new algorithm is faster about 61%.
The fix was pushed into the web-main:http://hg.netbeans.org/web-main/rev/a49d3a59079f
I would like to ask Petr Hejl to review it. Thanks
LOGGER.log(Level.FINE, "Building model took {0}ms. Resolving types took {1}ms", new Object[]{(end - start), (end - startResolve)}); Creates array even when logging is disabled. Check logging level in advance. Get rid of System.out. Otherwise looks good.
Thanks for the review. I have did the changes as Petr wrote. Also I increased the version of the index. http://hg.netbeans.org/web-main/rev/9708751ae76e
seems OK for me
http://hg.netbeans.org/releases/rev/5e5b37d59b02 http://hg.netbeans.org/releases/rev/9d7e2fb1fb2b Both fixes transplanted to the releases repository.
Integrated into 'releases', will be available in build *201302050851* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/5e5b37d59b02 User: Petr Pisl <ppisl@netbeans.org> Log: #225707 - Resolving types in model is very slow (transplanted from a49d3a59079ff2ee0237cc611f59d2013abc348d)
Integrated into 'main-golden', will be available in build *201302050917* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/a49d3a59079f User: Petr Pisl <ppisl@netbeans.org> Log: #225707 - Resolving types in model is very slow
no regression found, verified Product Version: NetBeans IDE 7.3 (Build 201302132200) Java: 1.7.0_15; Java HotSpot(TM) Client VM 23.7-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b02 System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)