-
Notifications
You must be signed in to change notification settings - Fork 7.6k
2.0 Design: Performance Benchmarking #2784
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
Comments
A goal for RxJava 2.0 is that nothing prevents it from being used in high-throughput, low-latency use cases. For example, the |
As an implementation note, I've been happy with JMH and the community around it. I suggest we continue with JMH at the |
So far with my reimplementation, I found these things that affect the performance characteristics:
|
This will be a big deal based on my past perf testing (#1383)
Wouldn't this be dependent on the source though? Most of the time it is synchronous emission on a given thread so that shouldn't need volatile/synchronized behavior. Similar to cancellation coming from an operator. A
I have pinged them via email.
Is there anything that is too burdensome and requires us pushing back on the RS spec? |
Most trivial Subscriptions (which are either forwarded downstream or the operator only calls its methods in-sequence from onXXX methods) don't need to add any extra synchronization. Again, it is a battle between biased locking and atomics: if everything is synchronous and non-thread-hopping, the usual serialization synchronized (this) {
if (emitting) {
missed = true;
return;
}
emitting = true;
missed = false;
} is much cheaper than an Making sure our internal behavior conforms to the RS-spec is low-to-medium annoying, but it helps in discovering bugs easier (i.e., seeing an NPE stating the rule violation helps me a lot). I'd say, in our entry (from-producer) and exit point (subscriber) to the Observable, we make sure the behavior conforms the RS-spec to the letter (by sinking errors into an uncaught handler and defensively serializing the Subscription). |
2.x is rearchitected and allocates far less than 1.x. Other algorithmic changes resulted in 2x-4x lower overhead in some cases. The gradle file has support for running JMH benchmarks, few of them ported from 1.x. I'm not too keen on porting all benchmarks and those can be added at anytime later in case some odd performace profile comes back from the users. |
Right from the start of RxJava 2.0 we should get performance benchmarking in place. Preferably we will get a mechanism in place that audits for performance regressions (RxJava v1 does not have this, we do it manually).
We need to leverage this while solving things like #2780 and #2782 which both prevent full performance in RxJava v1 due to extra object allocations and requirements for volatiles.
The text was updated successfully, but these errors were encountered: