Using several annotators and reference providers in one plugin

Hello,

In the plugin I am developing I have four annotators. Each one handles annotation for a specific token or element.
However I have realized that this might not be very effective since I assume that this means that four annotators have to go through the whole document?
The split is mostly for code readability so I am wondering how much I have to worry about performance when it comes to this.
One solution I have been thinking about is to have one annotator but let it hand over to another class depending on what it runs into. In this way there would only be one annotator but I can still split up my code in a good way.

Is performance likely to become an issue if I continue down the path of creating a new annotator or reference provider for each task?

1 comment

I wouldn't worry about that at all. Each local inspection tool is also a visitor that is called on every PSI element, and we have many hundreds of those. And splitting a reference provider has no performance impact at all; each individual reference contributor is handled separately in any case.

0

Please sign in to leave a comment.