19

We have a project on IDEA that consists of a couple med sized Java packages and one very small Kotlin package (5 files). I noticed performance is fine with any Java packages, but it's 10x slower in autocompletion, code analysis and compilation for the very small Kotlin package. Autocompletion occasionally was so slow to a point where the popover couldn't load all the methods and it had to load a couple API incrementally. Every time our developer types a word and wait for autocomplete, it takes about 2-5 seconds for the expected autocomplete to show up. Sometimes autocomplete was too slow to show anything, and we had to cancel the word and retyped it and waited. Same slowness occurs in code analysis. This is significantly impacting my team's productivity. From our research, it appears this is a well-known long lasting issue. This also happens for our another small project. I was wondering what we can do to fix this? Thanks.

Kotlin plugin is latest, Version: 1.1.3-release-IJ2017.2-2 Intellij is also on latest version, 2017 2.1 (built on July 31 2017)

Kelvin
  • 603
  • 1
  • 9
  • 13
  • Please file an issue at https://youtrack.jetbrains.com/issues/KT and attach the CPU snapshot (https://intellij-support.jetbrains.com/hc/articles/207241235). – CrazyCoder Aug 09 '17 at 04:00
  • I did, no response, https://youtrack.jetbrains.com/issue/KT-19509. Since this issue is fairly common, I wanted to see if other developers have a fix for this. – Kelvin Aug 09 '17 at 04:06
  • 1
    I am also facing a similar issue with Kotlin 1.3. Does anyone has found a solution to this problem? – Priyanka Feb 05 '20 at 12:56

4 Answers4

6

The problem visible in your snapshot is resolved in Kotlin 1.1.4. As of this writing, it's available as an EAP (Early Access Preview) release; the final version will be released soon (and bundled with IntelliJ IDEA 2017.2.2).

yole
  • 80,603
  • 15
  • 224
  • 177
  • 18
    Is it back in Kotlin 1.3.31? I'm just switching over from Java now.. and man, code completion is slooooooow. I mean, I can type faster than waiting for auto-complete. WTH? I'm sure it's not meant to be this way.. Google says devs love Kotlin.. –  May 18 '19 at 23:27
  • 4
    I have the same issue.. especially with one of file in project which has 1xxx lines of code. It takes like 2 seconds to show auto completion on every typing....terrible. – Arst Jul 07 '19 at 11:48
  • 2
    Despite all the improvements JetBrains has done recently, Kotlin autocompletion and highlighting speed is still terrible. I really hope they sort it out soon, with all the improvements Java has been making, I'd be tempted to go back. IDE speed is critical. – Yona Appletree Sep 25 '20 at 22:23
  • 6
    Facing this with IntelliJ Ultimate 2020 and kotlin 1.3 & kotlin 1.4 – Kumar Sambhav Sep 28 '20 at 07:22
2

Still happens in Kotlin 1.3.50. Got resolved by disabling Add unambiguous imports on the fly in Settings > Editor > General > Auto Import

  • 1
    Still happens in `IntelliJ 11.0.5` where this checkbox is not checked (neither by default nor now that it is happening) – lucidbrot Jan 11 '20 at 19:29
2

I recently ran into this with a Kotlin gradle multi module project. I managed to get back to a good code analysis and completion speed by massively increasing my memory settings in the vmoptions, this is what they look like now

-Xms512m
-Xmx16384m
-XX:ReservedCodeCacheSize=960m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=100
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Dsun.tools.attach.tmp.only=true
Nigel Savage
  • 661
  • 5
  • 17
  • I am facing this issue with Kotlin-1.3 and this solution worked for me with a slightly higher value for Xms1024 along with what you have mentioned in the solution. Thanks for sharing. – Priyanka Feb 05 '20 at 13:01
0

I've reached out to JetBrian and submitted a request to YouTrack. After reviewing the CPU snapshot, looks like upgrading the Kotlin plugin 1.1.4-eap which includes a major fix in performance will fix the issue. Just tried it and it worked!

Kelvin
  • 603
  • 1
  • 9
  • 13