Skip to content

Commit

Permalink
Eliminate unneeded LimitedDispatcher instances on `Dispatchers.Defa…
Browse files Browse the repository at this point in the history
…ult` and `Dispatchers.IO` (#3562)

* Handle `Dispatchers.IO.limitedParallelism(Int.MAX_VALUE)` case

`LimitedDispatcher.limitedParallelism` returns `this` if requested parallelism is greater or equal
to the own parallelism of the said `LimitedDispatcher`. `UnlimitedIoScheduler` has parallelism effectively set
to `Int.MAX_VALUE`, so `parallelism >= this.parallelism` check folds into `parallelism == Int.MAX_VALUE`.

Before the change `LimitedDispatcher(Int.MAX_VALUE)` was returned. While it does work as expected, any submitted task
goes through its queue and `Int.MAX_VALUE` number of workers. The change allows eliminating the `LimitedDispatcher`
instance and its queue in this extreme case.

* Handle `Dispatchers.Default.limitedParallelism` when requested parallelism >= core pool size (#3442)

`LimitedDispatcher.limitedParallelism` returns `this` if requested parallelism is greater or equal
to the own parallelism of the said `LimitedDispatcher`. `DefaultScheduler` has parallelism effectively set
to `CORE_POOL_SIZE`.

Before the change `LimitedDispatcher(parallelism)` was returned. While it does work as expected, any submitted task
goes through its queue and `parallelism` number of workers. The change allows eliminating the `LimitedDispatcher`
instance and its queue in case the requested parallelism is greater or equal to `CORE_POOL_SIZE`.

Fixes #3442
Added benchmarks on cacheable child serializers

Relates #1918
  • Loading branch information
vmishenev committed May 12, 2023
1 parent 3c239d4 commit 999b5a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/s3-snapshots.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace
arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace -i
env:
DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/coroutines
- name: Configure AWS credentials for S3 access
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace
arguments: :integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace -i
env:
DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/serialization
- name: Configure AWS credentials for S3 access
Expand Down

0 comments on commit 999b5a1

Please sign in to comment.