coroutineworker icon indicating copy to clipboard operation
coroutineworker copied to clipboard

The number of workers should default to the number of processors rather than a fixed 4

Open StefanOltmann opened this issue 3 years ago • 2 comments

On my MacBook Pro with 10 cores I see that only 4 of them are used. I guess this is because the number of workers is not configurable and set to a fixed 4. This should be configurable or at least use the number of CPU cores as a default.

https://github.com/Autodesk/coroutineworker/blob/57752c4e1122a52523a030b40a44f7d6573e2c90/src/nativeMain/kotlin/com/autodesk/coroutineworker/CoroutineWorker.kt#L50

StefanOltmann avatar Jun 14 '22 07:06 StefanOltmann

Good point. Making it configurable makes sense. Mind making a PR?

benasher44 avatar Jun 15 '22 04:06 benasher44

Ok, I can see why making it configurable is a tough one since a companion object is used for that nice CoroutineWorker.execute() API. So I focused on just using the processor count as default for the workers on Apple targets.

StefanOltmann avatar Jun 16 '22 13:06 StefanOltmann