-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Lift Performance #881
Lift Performance #881
Conversation
RxJava-pull-requests #813 FAILURE |
@abersnaze What about the debug hooks depends on subscribe vs f.call behavior? |
I like it as it reduces the call stack depth and I don't need to step though the hooks and internal implementation checks all the time. But isn't this lack of safeguards dangerous? |
I had always intended it to call Since The code would become this: public <R> Observable<R> lift(final Operator<? extends R, ? super T> lift) {
return new Observable<R>(new OnSubscribe<R>() {
@Override
public void call(Subscriber<? super R> o) {
if (!isInternalImplementation(o)) {
o = new SafeSubscriber<R>(o);
}
f.call(hook.onLift(lift).call(o));
}
});
} And the perf drops from ~10m ops/second to ~9m. With conditional check:
Without:
|
I personally refer to "f" as "unsafeSubscribe" and agree with Ben it should do nothing except chaining lift. Only at the end you insert checks. If you add an operator, you are responsible to make sure it does not mess things up. |
Using `f.lift()` directly instead of `subscribe` improves ops/second on the included test from 5,907,721 ops/sec to 10,145,486 ops/sec
RxJava-pull-requests #822 FAILURE |
Using
f.lift()
directly instead ofsubscribe
improves ops/second on the included test from 5,907,721 ops/sec to 10,145,486 ops/sec