-
-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplement parallelism internal logic #1991
Conversation
Using the common thread pool may have lead to starvation when embedding detekt. Only the compilation of Kotlin files was done in parallel using this flag. All analysis processing was always done in parallel.
Codecov Report
@@ Coverage Diff @@
## master #1991 +/- ##
=========================================
Coverage ? 80.39%
Complexity ? 1990
=========================================
Files ? 329
Lines ? 5610
Branches ? 1025
=========================================
Hits ? 4510
Misses ? 554
Partials ? 546
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we even test this with unit or integration tests?
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/CliArgs.kt
Outdated
Show resolved
Hide resolved
detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/Detektor.kt
Outdated
Show resolved
Hide resolved
…Args.kt Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>
…etektor.kt Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>
* Reimplement --parallel logic Using the common thread pool may have lead to starvation when embedding detekt. Only the compilation of Kotlin files was done in parallel using this flag. All analysis processing was always done in parallel. * Update documentation for --parallel change * Rely on stdlib use * Update detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/CliArgs.kt Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com> * Update detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/Detektor.kt Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>
* Reimplement --parallel logic Using the common thread pool may have lead to starvation when embedding detekt. Only the compilation of Kotlin files was done in parallel using this flag. All analysis processing was always done in parallel. * Update documentation for --parallel change * Rely on stdlib use * Update detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/CliArgs.kt Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com> * Update detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/Detektor.kt Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>
From the changelog:
Benchmarks:
detekt's parallelism is notated as p=false|true, gradles parallelism is notated as --p=false|true
Gradle Plugin run on detekt's codebase, ~40k lines:
1.1 clean buid --p=false p=false | 2.38s, 2.27s
1.2 clean build --p=false p=false | 2.30s, 2.25s
1.1 clean build --p=true p=false | 1.55s, 1.46s
1.1 clean build --p=true p=true | 1.53s, 1.47s
1.2 clean build --p=true p=false | 1.48s, 1.46s
1.2 clean build --p=true p=true | 1.46s, 1.45s
CLI on detekt's codebase, ~40k lines:
1.1 p=false | ~4.14
1.2 p=false | ~4.17
1.1 p=true | ~2.85
1.2 p=true | ~2.80
Conclusion:
There are no real performance benefits for a middle large project like detekt.
However there still could be some benefits for really large multi module Gradle projects when using Gradle's
--parallel
and using detekt'sparallel=false
.Imo the code looks cleaner now and there is the possibility now to just use one thread.
We also do not use the CommonThreadPool and do not make him starve.