Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Understanding why my Xtend editor is slow
Understanding why my Xtend editor is slow [message #1827587] Mon, 18 May 2020 18:51 Go to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 27
Registered: February 2016
Junior Member
Hello folks,

I'm experiencing regular hangs in the Xtend editor on a file of about 2000 lines of code. I'd like to understand what could be the bottleneck, i.e. which Xtend language features might be slowing down the editor, so that I could try to avoid them in my code and hopefully make editing that file bearable again.

Here are the symptoms:

  1. While editing that file in Eclipse, every ~3 seconds of typing (no save) the editor hangs for about 3 to 7 seconds. This makes editing the file without a nervous breakdown very challenging :) I sometimes resort to using a plain text editor.

  2. If I keep typing during the hang, the editor takes into account my input after it gets unblocked.

  3. Hangs occur even if I'm typing comments

  4. Disabling "Project" > "Build Automatically" doesn't solve the issue. I think this only affects what happens after saving the file.

  5. During the hang, the Progress view sometimes shows "Refreshing outline" and about 5 copies of "Updating editor state (Waiting)". Closing the Outline view didn't help (but "Refreshing outline" disappears). I don't know if the other jobs have anything to do with the hangs.

Here are the features of Xtend that I use in that large file:

  1. ~8 create methods

  2. ~8 dispatch methods (some are also create methods)

  3. A lot of triple-quoted strings.

  4. A lot of uses of => operator with [ ] lambdas

  5. 5 "extension" class fields providing utility methods on certain object types

  6. About 11 "import static extension" from EcoreUtil and EcoreUtil2. I tried avoiding the wildcard version "import static extension EcoreUtil[2].*" in an attempt to solve the hangs, but it didn't solve it and I'm not sure it even improved anything.

So might anyone have an idea on which of the above features may be the most likely culprit?

For example if I remove my use of create methods or extension fields, would that help? (although I really like the extension feature so I would like to still be able to use it)

Would moving extension class fields to the scope of the methods where they are used help?



Elie Richa, Ph.D
Software Engineer, AdaCore
Re: Understanding why my Xtend editor is slow [message #1827588 is a reply to message #1827587] Mon, 18 May 2020 19:47 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 742
Registered: July 2009
Location: Dortmund, Germany
Senior Member

2 kLoC Xtend files are not really special, I have seen lots of them. The days when editing experience was as you described are long over (I had the same headaches with 2.4). You can help Xtend a bit by reducing type inference, i.e. name types explicitly as return types of extension methods.

If you'd need to understand more about the potential bottleneck, use a profiler and see which methods are consuming much processing time.
Re: Understanding why my Xtend editor is slow [message #1827642 is a reply to message #1827588] Tue, 19 May 2020 20:43 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13722
Registered: July 2009
Senior Member
another thing to optimize is:

long chains of closures
many overloads in extensions

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Implementing AbstractLanguageServerTest in Maven project
Next Topic:Synchronize with resources
Goto Forum:

Current Time: Sat Jan 23 22:07:06 GMT 2021

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

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

Back to the top