https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

dg3feiko

04/19/2017, 3:35 PM
for JVM, I strongly recommend Quasar http://blog.paralleluniverse.co/2015/05/21/quasar-vs-akka/ for concurrent programming
🧌 1
e

elizarov

04/19/2017, 4:12 PM
Good project. Kotlin coroutines provide similar functionality on JVM but only if you write your suspendable code in Kotlin (no bytecode rewriting for arbitrary 3rd party code). Basically, Quasar’s
throws SuspendExecution
is semantically the same as Kotlin’s
suspend fun
p

pniederw

04/19/2017, 11:57 PM
@elizarov is it? quasar restores stack (traces)
e

elizarov

04/20/2017, 7:10 AM
Yes, it is. You can convert any Quasar code into Kotlin coroutines line-by-line, replacing
throws SuspendExecution
and
@Suspendable
into
suspend fun
as you go and it’ll work in a similar way. Kotlin also restores stack, though the implementation details differ (different performance tradeoffs). Quasar restores deep stacks eagerly, while Kotlin does it lazily
So, Kotlin’s resume is faster on deep stacks. Kotlin’s suspend is also faster. Kotlin is currently optimized for the code that does suspend, while quasar is faster on code that does not actually suspend.
👍 1