Understanding why my Xtend editor is slow [message #1827587] |
Mon, 18 May 2020 18:51 |
Elie Richa Messages: 72 Registered: February 2016 |
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:
- 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.
- If I keep typing during the hang, the editor takes into account my input after it gets unblocked.
- Hangs occur even if I'm typing comments
- Disabling "Project" > "Build Automatically" doesn't solve the issue. I think this only affects what happens after saving the file.
- 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:
- ~8 create methods
- ~8 dispatch methods (some are also create methods)
- A lot of triple-quoted strings.
- A lot of uses of => operator with [ ] lambdas
- 5 "extension" class fields providing utility methods on certain object types
- 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?
Thanks!
--
Elie
Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
|
|
|
Re: Understanding why my Xtend editor is slow [message #1827588 is a reply to message #1827587] |
Mon, 18 May 2020 19:47 |
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02886 seconds