IntelliJ at 100% while doing Scala

IntelliJ eats up 100% of my processors (ok, its a Mac air, but still) even after loading the entire project workspace.
Any small changes on the code will not get the compilation errors reflected for one or minute or so.

At the same time, compiling on SBT will take also quite a while. I am thinking it is a problem related to the language structure and usage, can anyone confirm?
Two issues that I can raise:
- by using implicits, the compiler can not keep cached (old compiled) versions of classes as when use class hierarchy or static imports
- any new method added to a type will result in recompilation of every type that access the original one (this could be optimized? only static imports, implicit related ones or hierarchies need to be recompiled?)

Any other suggestions why compiling a scala project (even if "incrementally") takes so long for such a small project (+-200 classes, big implicits, lots of traits and so on)?

Cheers

1 comment

Significant time causes implicit parameters and imlicit views search. I think this possibly still can be improved.
Another thing is type inference. IntelliJ IDEA API has stubs. It's most important information about classes (stubs are builded on indexing phase). But in case if method is not annotated by return type we cannot store return type information for this method, so we can store only method body text and infer type only from this text (and this takes time).
Also most of performance complex caches depends on class structure. If you change something in method body then you will get faster re-highlighting. However if method hasn't return type changing anything inside method body can cause changing of class structure so all caches will be cleared.
We hadn't complex dependency management, things I described here is all we have. So in IntelliJ IDEA there is no such incremental highlighting. We rehighlight opened in editor file on every change (however stubs mechanism is like compiled class file). I thought many times on something more complex in dependency managment, but I still don't know how to do it.

Also I can say that IDEA has noticeable API problem.Error highlighting is different pass than inspections. They start simultaneously however error highlighting works in one thread and inspections works in number of inspections threads and because of great number of inspections error highlighting will start right after all inspections will end.
Error highlighting pass works in way that you will see errors on visible area first. But because of inspections delay you have delay for errors on visible area and if you disable all inspection then highlighting of visible area will be quite fast. I'll also try to do something with this problem (possibly error highlighting will be moved to inspections pass), when I'll work on performance. Also I still hope that 1-2 weeks of my work still can improve plugin performance twice.

Performance is much better now than it was year ago, and I think this good tendency will be the same in the future.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.