Eugene Freeman
09/02/2020, 7:49 PMnanodeath
09/02/2020, 8:03 PMEvan
09/02/2020, 8:14 PMCasey Brooks
09/02/2020, 8:17 PMEugene Freeman
09/02/2020, 9:27 PMEugene Freeman
09/02/2020, 9:27 PMEugene Freeman
09/02/2020, 9:28 PMCasey Brooks
09/02/2020, 9:35 PMCasey Brooks
09/02/2020, 9:36 PMCasey Brooks
09/02/2020, 9:37 PMEugene Freeman
09/02/2020, 9:38 PMnanodeath
09/02/2020, 9:38 PMEugene Freeman
09/02/2020, 9:43 PMnanodeath
09/02/2020, 9:45 PMEvan
09/02/2020, 9:47 PMnanodeath
09/02/2020, 9:51 PMnanodeath
09/02/2020, 9:51 PMEugene Freeman
09/02/2020, 9:52 PMval ar = a()
val br = b(ar)
val cr = c(br, ar)
am I right that no benefit I'll get from the coroutines in terms performance? only thing is that ode looks nicer if I'd use Future or something like thisnanodeath
09/02/2020, 9:54 PMEvan
09/02/2020, 9:54 PMnanodeath
09/02/2020, 9:54 PMb(ar)
with b()
...parallelism is possibleEugene Freeman
09/02/2020, 9:54 PMCasey Brooks
09/02/2020, 9:58 PMval ar = a()
val br = b(ar)
val cr = c(br, ar)
these are sequential, coroutines won’t speed them up. b
depends on the result of a
, and c
depends on both. they cannot be parallelized, even with Futures or other concurrency mechanismsCasey Brooks
09/02/2020, 9:58 PMval ar2 = async { a2() }
val br2 = async { b2() }
val cr2 = async { c2() }
val (ar3, br3, cr3) = awaitAll(ar2, br2, cr2)
these are running in parallel. You do not need one to complete in order to complete the other. This will run 3x faster than the first example