Slow typing of dsl language, only at the bottom of the document in the dsl editor. [message #1412536] |
Tue, 26 August 2014 07:57 |
Eclipse User |
|
|
|
Hello,
I have few dsl plugins generated based on xtext workflow.
When I am trying to edit some big files, with over 10MB, with a dsl editor, I am getting a delay during typing only at the bottom of the editor.
I am trying to improve my dsl, to turn off some function to be able to type reasonable a big document.
I am new to text and dsl, and from what I have read and learned so far, I didn't found a way to do what I need.
Right now I am trying to create a patch for xtext plugins, I have debugged a lot xtext plugins, in order to understand what is responsible for such a huge delay during typing.
I found a piece of code that is responsible for this, but I do not quit understand its meaning. Please help me to improve it or to understand its workflow/purposes:
Before displaying something the whole dsl document is parsed, It seems like it needs to identify the position of changed piece of code.
I am using xtext 2.5.2
Debugged plugins
org.eclipse.xtext
org.eclipse.xtext.ui
In org.eclipse.xtext.ui.editor.model.XtextDocument
@Override
protected void fireDocumentChanged(DocumentEvent event) {
tokenSource.updateStructure(event); //if I comment this line, I am able to type very fast, but I do not have grammer/lexer colors
super.fireDocumentChanged(event);
}
what happens inside?
updateStructure() -> computeDamageRegion() -> getRepairEntryData()
Most of the time is consumed inside
org.eclipse.xtext.ui.editor.model.DocumentTokenSource.getRepairEntryData()
protected RepairEntryData getRepairEntryData(DocumentEvent e) throws Exception {
int tokenStartsAt = 0;
int tokenInfoIdx = 0;
for(tokenInfoIdx = 0; tokenInfoIdx< getInternalModifyableTokenInfos().size(); ++tokenInfoIdx) {
TokenInfo oldToken = getInternalModifyableTokenInfos().get(tokenInfoIdx);
if(tokenStartsAt <= e.getOffset() && tokenStartsAt + oldToken.getLength() >= e.getOffset())
break;
tokenStartsAt += oldToken.getLength();
}
....
}
My getInternalModifyableTokenInfos().size() = 2318396
and If I am typing at the bottom of the page, it traverses almost the whole size, till founds that tokenStartsAt = 2318393.
Then some other time consuming operations are performed.
If I hardcod the tokenStartsAt,I am getting into other issue.
I would like to have initial coloring, but I am not interested to apply lexer and color the new stuff that are typed, if not possible, but I am interested to be able to type fast. as normal.
Could you please improve it in new version?
But for know I am trying to solve it by myself, and I have lost myself between lot of token computation without any documentation.
Or please let me know where should I post my questions in order to get some responses. I am trying to find a solution for more than one week.
Thank you in advance
Lidia
|
|
|
Powered by
FUDForum. Page generated in 0.02519 seconds