Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Slow typing of dsl language, only at the bottom of the document in the dsl editor.
Slow typing of dsl language, only at the bottom of the document in the dsl editor. [message #1412536] Tue, 26 August 2014 11:57
Lidia Gutu is currently offline Lidia GutuFriend
Messages: 45
Registered: July 2013
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

In org.eclipse.xtext.ui.editor.model.XtextDocument
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

what happens inside?
updateStructure() -> computeDamageRegion() -> getRepairEntryData()
Most of the time is consumed inside

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())
		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
Previous Topic:Bundles required for Xtext 2.6.2 tagert
Next Topic:resolve EClass from base grammar during post processing
Goto Forum:

Current Time: Sat Sep 19 02:22:52 GMT 2020

Powered by FUDForum. Page generated in 0.01790 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top