Slow start of gradle task from IDEA

Answered

I have this NOOP gradle kts task in my kotlin project

tasks.register("time") {}

Repeated execution from WSL terminal takes like 0.6s:

time ./gradlew time

When I run the same task from Idea, it takes like 6 seconds - 10 times more.

 

I do not say it is slow in IDE, but there is extra overhead for each start. How can I eliminate that execution overhead?

I tried to switch target where it is supposed to execute Local machine/WSL. no change

 

Build #IU-251.26094.121, built on June 3, 2025
 

4
5 comments

Hello!
Thank you for reporting this!

Have you noticed if a specific action during the Task execution takes a long time (i. e. IDEA spinning up a Gradle Daemon each time you run the Task)?

Would you be able to share a brief screencast demonstrating the issue?

0

Hi Roman,

sorry for slow response. Here is recording: Slow gradle task startup in idea

Not sure if related, but every such run creates several folders in temp (I have to remove them manually from time to time)

Example of them after 1 run:

ls tmp*
tmpAPTu0O:
external-system-rt.jar  groovy.jar  util-8.jar  util_rt.jar

tmpFVZ4DJ:
external-system-rt.jar  groovy.jar  util-8.jar  util_rt.jar

tmpMU9NPn:
gradle-api-8.13.jar  gradle-tooling-extension-api.jar  gradle-tooling-extension-impl.jar  gradle.jar

tmphc3vg9:
gradle-api-8.13.jar  gradle-tooling-extension-api.jar  gradle-tooling-extension-impl.jar  gradle.jar

tmppteHy3:
ijJvmDebugger1.gradle  ijKotlinCoroutineJvmDebugInit1.gradle  ijMapper1.gradle

 

0

Moraveczbynek Thank you for sharing the video and the details!

I've ran some tests on my end and consulted with the developers on this matter and, unfortunately, it looks like this is expected behavior.

The method IDEA currently uses to interact with WSL requires it to copy certain files to the WSL file system each time a Task runs and that does have an impact on how long it takes to start the actual Task execution.

We will be looking into improving this behavior.

0

Thanks for your response, Roman.

If possible, it would be good to allow reusing of the files between executions. It would probably improve startup time and prevent out of space issues after several iterations.

0

Moraveczbynek That's the plan!

I'll make sure to highlight this issue for the developers and the Product Management Team. 

2

Please sign in to leave a comment.