CLI seems slower than Gradle plugin, trying to understand why? #5875
-
Hey team, We recently switched from using the gradle plugin, to the CLI - to improve our CI times. The idea is that if we use the CI, we don't have to build the project with gradle before running detekt. This brings down the CI time from 4 minutes, to 1 minute, which seems like a nice improvement. However, we've noticed that when running detekt locally, it is now slightly slower. Running detekt locally via the plugin takes about 4s on average, but running via the CLI takes about 6s (just roughly averaging over 10 or so runs each) I'm just curious why this might be happening. As far as I can tell, we're using the same includes & excludes, and both the plugin and CLI are using the 'parallel' flag. Could this have something to do with gradle caching? Does the plugin benefit from knowing which files have changed since the last run? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I would put my money on the class loaders. The gradle plugin does some magic there to ensure that the first run loads some classes and then you don't need to load them again. But, with the cli, you don't have that. But I don't understand the 4min to 1min improvement that you got with ci. Could you give more information about that? If that's true it should be tracked as an issue that we should fix. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response. The CI improvement is unrelated to detekt. The time savings relate to invoking the CLI without having to sync & build the gradle project. |
Beta Was this translation helpful? Give feedback.
I would put my money on the class loaders. The gradle plugin does some magic there to ensure that the first run loads some classes and then you don't need to load them again. But, with the cli, you don't have that.
But I don't understand the 4min to 1min improvement that you got with ci. Could you give more information about that? If that's true it should be tracked as an issue that we should fix.