Stefan Oltmann
06/02/2022, 2:37 PMchannel
or flow
in parallel.
I don't really find something here, just a discussion on GitHub: https://github.com/Kotlin/kotlinx.coroutines/issues/172
I understood that flow.buffer(3).collect { action() }
doesn't do that.
What I want is receive N (N = cpu cores) entries from a collection in parallel to process them.
I don't like how channel.receive() waits forever or throws an exception.
What would be a simple solution for that?simon.vergauwen
06/02/2022, 2:50 PMFlow#parMap
or Flow#parMapUnordered
.
The implementations are relatively simple if you don't want to depend on the full library.
https://github.com/arrow-kt/arrow/blob/18b946e8cb683c94b8cde4b39086a096a0139fb8/ar[…]fx-coroutines/src/commonMain/kotlin/arrow/fx/coroutines/flow.ktchristophsturm
06/02/2022, 3:36 PMStefan Oltmann
06/02/2022, 3:40 PM