Performance lag / UI freeze on large injection fragments


I'm having an issue with the MultiHostInjector.

Whenever a fragment is getting too big (let say about 700 lines) than pressing enter will cause the UI to freeze for several seconds. I've been able to pinpoint it to the doneInjection method of the MulitHostInjector but I have no clue why it happens.

When I have the exact same (injected) code but in a native file there is no such performance issue.

To reproduce you can check out my plugin project at: (master branch should be fine).

- runIde (or debug)
- create a new file called test.omt (OMT is yaml extension which is the host language of ODT)
- add the following script

commands: |
DEFINE COMMAND command() => { }
   DEFINE COMMAND command() => { }
   DEFINE COMMAND command() => { }
... create 150-200 duplications of this line this way

- press enter within the injected fragment, you should see the lag
- put only the injected fragment (so only the DEFINE COMMAND lines) into a file called test.odt and press enter, you should see no lag which confirms that the ODT language is not the issue
- inside the test.omt, keep the number DEFINE COMMAND lines to 20, but then repeat the entire commands: block 10x. You will see that each block works fine, confirming that it's not the total size of the omt file either.

What I also noticed is that whenever a change is made to and the MultiHostInjector is injecting the content again, it happens many times on different threads. However, at the flow is synchronized which might cause the different threads to wait on eachother constantly getting read/write locks for that peace of code.

Hope someone can help with this issue because it's making it difficult to work with larger files this way.

Comment actions Permalink

1. in your plugin.xml, please add     <depends>org.jetbrains.plugins.yaml</depends>
2. regarding injection performance problem, added your case to

Comment actions Permalink

Hi Yann,

Thanks for your response. The depends statement is already part of the plugin.xml file (line 270).
Do I understand from the issue that this is specific to injection fragments for YAML host element or is this also observed elsewhere?


Please sign in to leave a comment.