Skip to content
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

2.x: Dedicated {Single|Maybe}.flatMap{Publisher|Observable} & andThen(Observable|Publisher) implementations #6024

Merged
merged 2 commits into from
May 27, 2018

Conversation

akarnokd
Copy link
Member

This PR implements the following operators directly instead of conversions between base types:

  • Single.flatMapObservable
  • Maybe.flatMapObservable
  • Maybe.flatMapPublisher
  • Completable.andThen(Observable)
  • Completable.andThen(Publisher)

The Single.flatMapPublisher was reimplemented in #6021 already.


@Override
public void onComplete() {
ObservableSource<? extends R> p = other;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o


@Override
public void onSuccess(T t) {
ObservableSource<? extends R> p;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o


@Override
public void onSuccess(T t) {
ObservableSource<? extends R> p;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o

@akarnokd
Copy link
Member Author

Benchmark comparison with baseline: (i7 4770K, Windows 7 x64, Java 8u172, JMH 1.20):

image

Other that 3 cases with slightly degraded throughput (probably Windows related), these are nice improvements.

Comparing Maybe and Single flattening:

image

These should be practically the same. There is also a slight performance drop for count=1 flatMapHide publisher which is likely due to the backpressure inside Flowable.just().

@codecov
Copy link

codecov bot commented May 27, 2018

Codecov Report

Merging #6024 into 2.x will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6024      +/-   ##
============================================
+ Coverage     98.27%   98.28%   +<.01%     
- Complexity     6161     6173      +12     
============================================
  Files           660      665       +5     
  Lines         44557    44717     +160     
  Branches       6201     6205       +4     
============================================
+ Hits          43790    43948     +158     
- Misses          228      233       +5     
+ Partials        539      536       -3
Impacted Files Coverage Δ Complexity Δ
...nternal/operators/mixed/MaybeFlatMapPublisher.java 100% <100%> (ø) 2 <2> (?)
src/main/java/io/reactivex/Single.java 100% <100%> (ø) 146 <1> (ø) ⬇️
...ternal/operators/mixed/MaybeFlatMapObservable.java 100% <100%> (ø) 2 <2> (?)
src/main/java/io/reactivex/Maybe.java 100% <100%> (ø) 171 <2> (ø) ⬇️
src/main/java/io/reactivex/Completable.java 100% <100%> (ø) 115 <0> (ø) ⬇️
.../operators/mixed/CompletableAndThenObservable.java 100% <100%> (ø) 2 <2> (?)
...ernal/operators/mixed/SingleFlatMapObservable.java 100% <100%> (ø) 2 <2> (?)
...l/operators/mixed/CompletableAndThenPublisher.java 100% <100%> (ø) 2 <2> (?)
...nternal/operators/parallel/ParallelReduceFull.java 91.08% <0%> (-3.97%) 2% <0%> (ø)
...nternal/operators/observable/ObservableCreate.java 94.87% <0%> (-3.42%) 2% <0%> (ø)
... and 30 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07586f4...2bec94c. Read the comment docs.

@akarnokd
Copy link
Member Author

/cc @davidmoten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants