[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[wtp-dev] Question on AST creation for decoration-like jobs
|
Chris, Nitin, and JSDT adopters!
I've got a question to JSDT Developers (more experienced than me) and to
adopters that use JSDT in/for their projects.
What is the point of resolving bindings each time we need to create an
AST when reconcile? (It happens for almost each character typed in by a
user or the selection is changed in the editor).
The method
org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.createAST(IJavaScriptElement,
IProgressMonitor) is used in many operations and actions, such as
StructuredSelectionAction, SemanticHighlightingReconciler,
OverrideIndicatorManager, SelectionListenerWithASTManager,
OverrideIndicatorLabelDecoration and way many more. And each time it's
executed it tries to resolve bindings, because it's set up to do so:
556: final ASTParser parser = ASTParser.newParser(SHARED_AST_LEVEL);
557: parser.setResolveBindings(true);
558: parser.setStatementsRecovery(SHARED_AST_STATEMENT_RECOVERY);
559: parser.setBindingsRecovery(SHARED_BINDING_RECOVERY);
Do we really need the bindings to be resolved when calculating the
semantic highlighting, for example?
When I turned off the parser's settings that are set up in lines 557-558
(actually by commenting these lines) I'm getting the AST produced almost
8 times faster and no more StackOverflowErrors in "Semantic Highlighting
Job", "Requesting JavaScript AST from selection" and "Decoration
Calculation" Jobs.
OK, to be honest, not all the StackOverflowErrors have gone, but most of
them have gone.
I'm going to disable the bindings resolving when creating an AST in
ASTProvider.createAST(...) method or create an additional methods for
the Jobs like a decoration one in order to improve the JavaScript Editor
performance. So, I'd like to know which way is better: to completely
disable the bindings resolving in createAST(...) method, or to create a
special methods for AST creation and use that special method in
'decoration'-like jobs.
Can you tell me what's going to be broken if I'll go the first way (by
just commenting out the lines 557-559)? Or what I should test with care
to be sure that I didn't break something?
I've tested it briefly in my environment and I didn't spot any problems,
while the performance was really boosted for some test files. Also, not
a JUnit test forced to fail after such a change in my environment.
Thanks in advance,
Victor