Home > database >  How to debug slow "Parsing Java...." in IntelliJ IDEA
How to debug slow "Parsing Java...." in IntelliJ IDEA

Time:08-07

I have a bigger Java project with plenty of maven dependencies and a big Swing GUI with about 13,000 lines of code in a single class. Whenever I modify the GUI and recompile/run, it takes about 3 - 4 minutes in the "Parsing java..." compilation stage in IntelliJ IDEA. This is frustrating if you have to repeatedly wait for this. Is there any way to get insights into what's taking so long? Maybe a certain class or library adding plenty of compilation time? I assume it's that big Swing GUI class and/or the usage of the IntelliJ GUI designer. And yes, I know I should refactor this class and I shouldn't complain about such a "small" delay when there are projects out there taking far longer. However, it's not that simple and I feel like the performance is not right, we're not talking about a class with like 100.000 lines of code. Typing and code analysis is also slowed down heavily in this class. Java code should be faster to parse than that. I see similar C# projects compiling within seconds. After some researching, it doesn't seem like IntelliJ IDEA offers viable options to debug the compilation performance. What would be my best options?

CodePudding user response:

As suggested in the comments, the GUI designer might be one of the causes for slow Java parse times. Another big elephant in the room turned out to be the recursive inclusion of same dependencies via maven. After cleaning those up and only including each dependency once, the full recompilation times improves to about 45 seconds while still using the GUI designer.

  • Related