Profiling resolve and annotation code?

I'm having some problems with the performance of my resolve code and also of my annotation code. I'd like to be able to profile these, but it's difficult to do in a running IDE. I was considering writing a command line application to load a project and force a resolve of all symbols in the project, which should be considerably easier to profile. I've seen JavaCoreProjectEnvironment and JavaCoreApplicationEnvironment but I'm not sure how I would use these with a custom language plugin. Can anyone shed any light on how I might do this? Alternatively, is there an easier way to do what I want to do?

10 comments

Hello Colin,

there's a full tutorial on how to write tests for custom language plugins:

http://confluence.jetbrains.com/display/IntelliJIDEA/Writing+Tests+for+Plugins

0

Thanks Yann, I've seen that. But there's nothing specific to performance in there, right? I assume this is just a convenient way to trigger resolve and annotations for a bunch of files outside the plugin itself (which is what I'm after, just checking that's your intent?)

0

Yes, that was just a hint on how to build standalone unit/performance tests for your custom language. You can attach a profiler to your tests to perform actual measuring, some very basic (=total highlighting time) numbers are returned from the testHighlightingXXX() methods.

0

Perfect, thanks very much, Yann.

0

Hi,


Sorry for oppening old threads but I hope it's better this way.
I'm facing a similar question right now but maybe I'm looking for something a bit different.
In the go plugin, syntax highlighting and resolving is currently slow for files above 50-100 lines and I have no clue where to start looking for issues.
How should I profile this? I'm used to run something like pprof / xdebug and have a diagram of function calls and number of calls / function and time spent / function.
Thank you very much for your time.


Kind regards

0

Florin, are you referring to this repository https://github.com/go-lang-plugin-org/go-lang-idea-plugin ?

The best way (IMHO) to find and fix performance problems is writing unit tests triggering various stages of highlighting.
"Syntax highlighting" is a bit broad - Lexer, Parser, Annotator, Inspections? Or resolving?

Without any measurements, it's hard to give pointers on how to actually improve performance without trying to understand the full language plugin ;-)

0

Hi Yann,


Thanks for the quick reply, yes, that's the one
The trouble is that it is pretty complex already. While I know that for example the parser should be redone using GrammarKit and build upon it, that would be a huge effort and meanwhile people are using it (and some even enjoy it :D), hence why I'm looking for a way to profile this and see what happens inside it while it's doing.
Right now, what I do have a clue is that it's doing a lot of work while the 'syntax analysis' stage, according to the progress bar on the top right corner of the file but I have no clue where to start looking for info. That's why I was looking for something that could have an output like: http://goog-perftools.sourceforge.net/doc/pprof-test-big.gif

Thank you very much.


Kind regards.

0

An even easier way would be to simply connect profiler to running IDEA instance and record CPU performance/invocation count while a file is opened and highlighted.

If there really are hotspots in your code, they will be pretty easy to locate after repeating this with a few bigger files.

0

Hi Yann,


Thanks for your help.
I've seen that IDEA uses http://www.yourkit.com/ for doing the profiling and they have a very nice integration with it so I've used that to find this: https://github.com/go-lang-plugin-org/go-lang-idea-plugin/issues/603 (not necessarily relevant for the topic).
I wonder if it would be possible for you guys to provide a link to it in the wiki pages so that other people can know about it?
I know it's not for free and it's a product that's not created by JetBrains but none the less, it's very useful. If however there's something similar that I could have used and it's part of IDEA or another project from JetBrains, do let me know.


Best regards,
Florin

1

That looks like you got some useful data there.

We do not promote or endorse any profilers, and we do not offer any profilers for Java ;-)

0

Please sign in to leave a comment.