https://kotlinlang.org logo
f

frellan

05/23/2018, 6:58 PM
Hello! I have a problem, I want to speed up some heavy computation in an app im building. I have rewritten my algorithm so now it is possible to split up the heavy parts, I basically now have a for loop that does some heavy stuff with each iteration and then returns a
List
. At the end of each iteration I add this
List
to a
List<List>
. Now, instead of running this concurrently which I am now, I want to split this up and give it to a couple “workers” I guess. Each worker calculate some stuff and then respond back with the
List
or alternatively a
List<List>
that I can then later flatmerge into a bigger
List<List>
. How do one do this with courutines as fast as possible? Run iterations in parallel and collect the combined result essentially, I am having trouble understanding if there even is a performance gain here.