Hello everyone. I wanted to know if someone had so...
# coroutines
c
Hello everyone. I wanted to know if someone had some concrete data about the performance of Coroutines vs RxJava? I have used coroutines myself for several years and I prefer it over RxJava but I am working to migrate some codebases from Rx into coroutines and I need to convince the right stakeholders about this change. My plan was to put together a small sample program and run multiple scenarios. But if someone has some data already that they would be willing to share, that would be awesome 🙂 .
b
Unfortunately, I don't think there are good news here, rx will win in most of the synthetic benchmarks. Advocating to migrate to coroutines should be based on developer productivity / simpler way to write a concurrent code.
c
I totally agree with regards to productivity and much simpler way to write concurrent code. I am still interested in knowing the numbers though, even if Rx is more performant than coroutines. I will see what numbers I can grab on my side. I will share once I have them.
Flow has at least as good (if not better) performance than RxJava.
Reactive Scrabble is the usual benchmark tool for streaming comparison, and Kotlin has a version of the benchmark in their repository. By their metrics (lower score is better), Flow outperforms RxJava in both the standard and optimized setups.
This was from a while ago
c
I wrote some code to test the performance between RxJava2 and Coroutines. I posted it here. Some interesting data, overall coroutines were a bit slower but the memory consumption of Rx is a deal breaker for me.