You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Eliminate unneeded LimitedDispatcher instances on Dispatchers.Default 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
0 commit comments