New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mono.then vs Mono.flatMap #376
Comments
I think its down to the implementation of block which we don't try much to optimize. I'd recommend benching using subscribe first, but you can try to tweak the current code using |
This could be also a benchmark-method anomaly. Could you test it with JMH? I get these:
RxJava 2 for reference:
|
Hi,
The behaviour looks even a bit worse. But when you get equivalent for flatmap and then results, it might be just an anomaly on my system/jvm/etc. |
Run it with |
Hi, //Old JDK
// New JDK
So now i get the same results. Thanks and sorry for the trouble! Regards, |
Hi,
I found an inconsistency, which is boggling my mind. The usage of the 'then' operator of Mono is (on my machine) 50% slower than the usage of flatmap. I used the following code:
I would understand if the flatmap-operator would be slower (since he is more powerful) but I see no rease why the 'then' is the slow one. The speed of 'then' is of no concerning level, but i was curios why there is a separate implementation, when it can substituted with flatmap.
Regards,
Malte
The text was updated successfully, but these errors were encountered: