Forget RxJava: Kotlin Coroutines are all you need. Part 1/2
Vladimir Ivanov
1.3K7

This kind of object allocation amount comparison doesn’t make any sense.

First of all, each of the approaches can create objects that are out of the packages you’re monitoring. What if coroutines allocate like 1000 different objects (lists, arrays, atomics, locks, etc)? Or same for Rx.

Second thing, 19 objects vs 11 is a ridiculous difference in the environment where thousands of objects are getting allocated each minute, even if you extrapolate it to a more complex setup.

Remember how much time you spent understanding the difference between map() and flatMap()

So your point is that coroutines are better because they have no operators? If the operator is complex, then it probably solves a complex problem, that you would have had to solve on your own otherwise.

And lastly, I don’t think that coroutines example with try-catch is any more readable. Plus it lacks a lot of potential extra features, like retries, fallbacks to some result in case of failure.

Coroutines might be better for some cases, but saying they are Rx killers is definitely too much, IMO.

Like what you read? Give Dmytro Saviuk a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.