My Maven+Java+Kotlin project is getting unbearably...
# intellij
p
My Maven+Java+Kotlin project is getting unbearably slow. Editing Java files is okay but editing Kotlin files is excruciating. Typing anything results in 5+ second freezes where not even the cursor blinks. Everything works correctly, just super slow. Any quick things I should check? Is there a way to debug IntelliJ performance?
h
Have you tried invalidating caches and restarting? That's my go to when I'm having intellij performance problems.
m
Latest IntelliJ and latest Kotlin plugin? Is your project really big? Did you turn on ‘delegate to maven’ for builds? Either of those might lead to the issue too.
p
latest everything, project is average size I think, 5 modules, less than 1M LOC i don't have
delegate to maven
turned on, i haven't actually tried it but i am guessing it would make it slower
m
Especially since it’s relatively new… Sometimes if the Kotlin file is large, and there’s an error in it, the IDE gets very slow rendering. But I haven’t seen that for quite awhile personally.
p
yeah Mike, I see that too.. let's say 80% of the file is highlighted with errors for some reason, suddenly it's almost impossible to fix the file.. only thing that improves it is turning on Power Saving Mode 😕
I never have this issue in Kotlin-only project. I really need JetBrains to give Maven + Java + Kotlin combo more love, it's one of the most common paths for companies that are Java-only to move to Kotlin.
m
I suspect it’s the back-and-forth of the compilers. java interfaces -> kotlin -> java and then with errors…
r
Well usually in Kotlin you try to have smaller files, maybe that’s why performance problems with huge files aren’t prioritized? I usually don’t have this problem. My longest Kotlin files are my
build.gradle.kts
and I could split them in theory
r
I get this periodically as well, though it comes and goes. I'll fire up IJ and things will be fine for a while, but then seemingly randomly things will get really slow and I have to restart IJ. I've tried once or twice to submit perf snapshots on YouTrack but with not much success.
It's also difficult to capture the right snapshot, because things aren't consistently slow... they'll be fine for a bit, then really really laggy, then fine for a bit again. Checked all the usual suspects: memory settings, etc. and so far I've got no solutions.
And its not specific to one Kotlin file -- it's the whole IDE getting slow for all Kotlin files. @poohbar did you find any solutions?
p
Not yet. Restarting IntelliJ improves things a little bit for a little while so I suspect it's some sort of leak.
r
Yup, agreed. I'm running for a while with Activity Monitor open to see if I can notice a pattern/change as IDEA gets slower.
It seems to be a Kotlin-related memory leak. I've submitted this issue: https://youtrack.jetbrains.com/issue/KT-31546
Looking at the activity monitor, the underlying problem in my case might actually be this: https://youtrack.jetbrains.com/issue/IDEA-207243