fwcd / vscode-kotlin

Kotlin code completion, debugging, linting and more for VSCode
MIT License
296 stars 39 forks source link

CPU resource consumption #111

Open takapiro99 opened 1 year ago

takapiro99 commented 1 year ago

Description

After a short while of opening a kotlin project, it consumes most of the CPU resources.

It also activates the heat dissipation fan, which is unusual for M1, and makes the entire PC run slower.

Any clues as to the cause?

thanks in advance.

Extension version

v0.2.26

Additional context

MacBook Pro (14in, 2021) Apple M1 Max, 64GB memory

themkat commented 1 year ago

I use a Macbook Air M1, and have never experienced such issues 😱 Big projects are a memory hog (due to the indexer in the language server), but CPU is usually stable. Some questions:

  1. Does this happen always? Or just when opening projects? The indexer needs some time to start, and my main guess is that it takes more CPU as well due to all the processing being done. We have some issues in the language server on this, most notably this one: https://github.com/fwcd/kotlin-language-server/issues/352. For bigger projects you should expect some time for the indexing and initialisation to be done. Then everything should be pretty stable (though with some memory usage).
  2. What Java version are you using? I experienced much more effective (i.e, less CPU usage and faster processing) when upgrading to Java 18 on my M1 Mac. Maybe this could be something to try? Especially if you use an older Java version. Also, make sure you are using a Java build for Apple Silicon/ARM, and not a X64 build that will be emulated through Rosetta.
  3. Do you have any special settings for Java on your machine? Having too little memory, heap size etc. might cause the garbage collector to run more often. Do you have any custom settings for memory, garbage collection etc.?
  4. Is this a very big project? Or do you experience it with different projects? Big projects will use more resources, especially memory. Might as mentioned in 1 use more CPU during indexing as well.