Kelvin
Kelvin

Reputation: 723

Extremely slow in autocompletion & code analysis for Kotlin projects in Intellij IDEA

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)

Upvotes: 27

Views: 11810

Answers (6)

Grogu
Grogu

Reputation: 512

This question appears when you search for current (2024/2025) autocompletion issue in intellij without language specificity.

So for this current and more generic issue: intellij ia autocompletion is super slow and kind of useless. This can be disabled in:

Settings > Editor > General > Code completion > Machine Leaning > Assisted Completion

intellij configuration to disable ia code completion

Then, uncheck Sort completion suggestions based on machine learning

This should get things back to normal.

Upvotes: 0

user1409784
user1409784

Reputation:

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

enter image description here

Upvotes: 3

Erick Pranata
Erick Pranata

Reputation: 101

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

enter image description here

Upvotes: 5

sarjeet singh
sarjeet singh

Reputation: 551

you can just change the Kotlin version to something else and then gradle sync again This will solve the issue

you will find it in build.gradle file(project)

ext.kotlin_version = "1.5.21"

 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Upvotes: 0

Kelvin
Kelvin

Reputation: 723

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!

Upvotes: 0

yole
yole

Reputation: 97278

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).

Upvotes: 7

Related Questions