RubyMine, being an IDE and not light editor, is expected to hog some CPU. But after each RSpec run, the CPU usage jumps to 300 % for several minutes. If I do fast iteration on specs, then this high CPU usage is constant and heats up my Mac, causing fan noise and of course drains battery.
Googling around for solution did not find anything, especially as there are not background processes running. I even tried profiling the app to see if it gives any ideas (hint: it did not).
One support ticket for WebStorm though tipped me off and turned out that the culprit are Inspections – those little yellow or red markers around right gutter that tell you when your code smells or is outright broken.
Handpick the Inspections
Navigate to Preferences > Editor > Inspections and go through the long list. Unfortunately RubyMine does not tell you which Inspection it currently runs, so it is trial and error to find out what causes the slowness.
In my case there were a lot of “Double quotes” as well as whitespace whitespace warnings, but growing tired of not finding any low hanging fruits, I decided to just disable almost all warnings and left only error-level Inspections.
Now, after running specs, RubyMine CPU usage jumps to around 100 % for only a little while and then returns to normal.
A note on tabs
RubyMine has default setting of allowing only a handful of tabs open at the same time. Increasing this limit affects, among other things, the Inspections performance too as these are run for all tabs after every spec run. (Don’t ask me why JetBrains thinks this is necessary.)