elizarov
05/04/2017, 6:58 AMsuspend fun
(this is covered in the spec quite well) in anticipation of suspension, even if that invocation will decide not to suspend. So here is the full table of differences:
spill on suspend restore on resume
Quasar LAZY EAGER
Kotlin EAGER LAZY
You can interpret it in this way: Quasar is optimised for the code that rarely suspends, while Kotlin coroutines are optimised for the code that often suspends. This properly of Kotlin coroutines is not an accident, since they were originally optimised for an efficient implementation of generateSequence/yield
pair that should work almost as fast as a manual implementation of the Sequence
. However, we have a lot of room to tweak those performance trade-offs in future updates (even without breaking compatibility) as we get more data on how coroutines get actually used in the wild.kenkyee
05/04/2017, 1:01 PM