IntelliJ IDEA 2022.1.3 debuggnig steps is taking 10+ seconds - intellij-idea

I'm using IntelliJ IDEA 2022.1.3 on Mac 11.5.2 and trying to debug simple java method.
Each of the method steps including just declaration of variables is taking almost 10+ seconds to execute.
Normal execution is fine
You can easily reproduce this bug with simple addition of 2 numbers method as well.

Related

Big compilation time for Kotlin code in IntelliJ

I have used Kotlin with latest version of Eclipse for 2 months without any performance problem on my Windows 10 computer.
Now I would like to do a live coding session about Kotlin with intelliJ (since it's the JetBrains language...) ultimate edition that I just installed and never used before, on a recent OSX computer. The two computers have good hardware and are no limiting my tests.
My problem is that each time there is a modification in my Kotlin code, the compilation time is between 8 seconds and 35 seconds. I did my tests on minimalist code:
class TestKotlin {
var a = 1
}
If I change the variable "a" and so need to build again, it always need 8 seconds in the best cases to complete the compilation.
Since I want to do a live coding session with a lot of small functions and compilations, this kind of delay is way too much significative.
The viewers will need to wait a lot before to see the results at each compilation, they are logically expecting good performance from IntelliJ tool.
In the same project, I tried to do the same kind of Java class (with a single attribute) and modify its attribute in order to trigger the compilation, and it takes less than 1 second to compile.
I tried to manually compile the code in command line with that:
kotlinc hello.kt -include-runtime -d hello.jar
java -jar hello.jar
I had some decent compilation times, even if it was near to 3 seconds.
When I look at the "Messages" screen in IntelliJ while it is compiling Kotlin code, I can see this:
Information:Kotlin: Kotlin JPS plugin version 1.0.6-release-127
Information:Kotlin: Using kotlin-home = /Users/myUsername/Library/Application Support/IntelliJIdea2016.3/Kotlin/kotlinc
It stops here for all the compilation time, and then do almost instantaneously the next steps:
Information:Kotlin: Kotlin Compiler version 1.0.6-release-127
Information:17/01/17 11:38 - Compilation completed successfully in 11s 639ms
Maybe there is a problem in the configuration of IntelliJ or something like this. I had a hard time at searching for something that could improve the performances but nothing helped me...
I would be very grateful if someone can help me to have some realistic compilation time with Kotlin in Intellij like in Eclipse!
This seems similar to the problem KT-15491.
To ensure that it's your case too, try to execute the following simple Kotlin program:
import java.io.File
import kotlin.system.measureNanoTime
fun main(args: Array<String>) {
val elapsedNs = measureNanoTime { File.createTempFile("tmp", "", null).deleteOnExit() }
println(elapsedNs.toDouble() / 1000000000)
}
If the printed elapsed time is significantly greater than a fraction of a second, than that is the reason.
This issue affects not only Kotlin compiler but every JVM program that tries to create a temporary file, or to do any other action involving SecureRandom class.
I've experienced the same slowdown on each JPS build on my Windows 7 notebook. I've tried the workaround with security providers order described in this question and it helped.
Make sure you have checked those boxes in settings:
Incremental Kotlin compilation
Kotlin compiler daemon (keeps the kotlinc process alive)

Starting IntelliJ for inspections in Teamcity are very slow. Is there a way to speed it up?

we are using Teamcity (9.1.7) for our maven projects and are considering to switch from checkstyle/pmd/findbugs to IntelliJ inspections as we are using IntelliJ anyways.
The problem is that the build time increases by more than 4 minutes, most of the time waiting for IntelliJ to start (if I read the build log correctly). The inspection itself is fast enough, but the starting issue really blocks us from using it.
Is there a way to speed up the start or to have IntelliJ running all the time on the agents?
Thanks!
Update: I disabled a whole bunch of plugins and the start time decreased to about 1:30. Still not good (so suggestions are still welcome) but at least usable.

IntelliJ idea slow/hang during debug make phase

Currently experiencing very slow debug start up times (between 25-45 seconds) with idea CE 14.1.5. To reproduce:
Make change in code that will cause javac to be invoked.
Hit debug.
Status bar shows "Make" and entire IDE hangs.
I'm using a 2015 Macbook pro and Java 1.8.0_60 64bit.
After profiling with advice from above, I tracked it down to this issue:
IntelliJ freezes for about 30 seconds before debugging
Which in turn points to an issue with InetAddress.getLocalHost() on *nix. Following the advice in this linked post certainly helped it go away:
InetAddress.getLocalHost() throws UnknownHostException
I had similar problems of starting debugging application and tried different workaround tips to figure it out, but in my case i had a lot of forgotten breakpoints marked in application and removing them all application starts and performs lightening fast.
So, my advice remove all the breakpoints from the code at least at application startup.
You should assign more memory. This almost always reduces lagging / hanging issues. You can find a guide how to change this setting in IntelliJ manual.

Intellij takes for ever (>30 seconds) before even attempting to run/debug a main

Using IntelliJ under Windows/Linux and Mac (13- 14 and 14.1) every time I launch the Main it takes a very long time (> 20 seconds) being completely idle before starting to compile or launch the program.
The same 1 minute block happens just editing the run configuration: it appears white for the exact period before showing the running/debug configuration.
This appear independend of the OS and the speed of the CPU/Disk I'm using, so I'm hoping it's just some "timeout" happening somewhere.
Unit tests which are doing something similar are taking a bit but not so much, and if I launch the same main from Eclipse it starts instantly.
Is there something I'm missing in configuration of IntelliJ / Run or in setup of IntelliJ to avoid this long block?
NOTE: The project has some multiple modules in it separating the spray routing in a module, the datamodel (mongodb) in another, data definition in a third one and having multiple sbt script, could it be possible that this time is related to some sbt activities or inconsistencies in dependencies?

dependencyOverrides causes sbt update times to go up by 4-5x

SBT 0.13.1 and Scala 2.10.3.
We have implemented a plugin that sets the dependencyOverrides to standard artifact versions. My dependencyOverrides set is about 950 artifacts large. Not that we have all these dependencies but this is the standard versions people need to use.
After implementing the overrides, sbt update times (a reference project with 11 sub-projects) on Mac (Mac OS 10.7.5, Oracle JDK 1.7.0_45) jumped from ~30 seconds to ~140 seconds. The referenced artifacts are actually smaller as this gets rid of many duplicate artifacts of different versions.
I've run sbt under -Xprof to see what is the problem and found this major difference:
Before dependencyOverrides:
Compiled + native Method
3.2% 10 + 0 org.apache.ivy.core.module.id.ModuleRules.getRules
After dependencyOverrides:
Compiled + native Method
31.6% 136 + 2 org.apache.ivy.core.module.id.ModuleRules.getRules
Xprof doesn't give me invocation counts. But from a brief review of ModuleRules.getRules there seem to be not much complexity. That gives me a hint the invocation count may have skyrocketed. I'll have to use different profilers to get a better grip.
Unfortunately, Scala/SBT plugin for IntelliJ constantly causes a sbt resolve and the user experience is that much worse. I'd like to run this by others who may have run into this issue before or even know of a good way to fix it (short of diving into ivy code and figuring out the issue + modifying ivy code myself).
Thanks in advance for any input.