spekframework / spek

A specification framework for Kotlin
Other
2.23k stars 179 forks source link

High CPU when writing tests using Spek in IntelliJ IDEA Ultimate #892

Open Misoder opened 4 years ago

Misoder commented 4 years ago

I'm currently on IntelliJ IDEA 2020.1.2 (Ultimate Edition) Build #IU-201.7846.76 (although the problem has been present on earlier versions) and Spek 2.0.9. OS is macOS 10.15.5 Catalina.

When writing Spek tests there's a high CPU load up to the point where it's almost unbearable. Auto completion and code inspection takes several seconds. This is not an issue when writing code elsewhere. Looking at the IntelliJ Activity Monitor there's usually two things that eats CPU: <unidentified: JobScheduler FJ Pool> and <JIT Compiler>

raniejade commented 4 years ago

Thanks for the report @Misoder, have you tried invalidating the cache? Also can you provide a sample project that can replicate the issue?

arturbosch commented 4 years ago

@Misoder @raniejade this may not be spek but Kotlin itself. I've experienced the same with large files (1k+ code) and heavy usage of lambdas, lambdas with receivers and when expressions. Spek's nature is to use many lambdas. How large are your files?

charleskorn commented 4 years ago

I've seen similar things @arturbosch - have you opened an issue with JetBrains? Seems like it might be an issue in the IDE or compiler like you suggest.

arturbosch commented 4 years ago

@charleskorn I haven't but I saw a lot of similar performance issues last time I checked in 2019. Hopefully the new compiler frontend (FIR) will resolve these issues.