Skip to content

1.x: benchmark just and Single #3982

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

Merged
merged 2 commits into from
Jun 1, 2016
Merged

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Jun 1, 2016

This PR adds a comparison benchmark for working with Observable.just and Single.just.

Results: (i7 4790, Win 7 x64, Java 8u92)

image

  • one: custom Observable emitting a single item with backpressure
  • scalar: Observable.just(1)
  • scalarHidden: just(1).asObservable()
  • single: Single.just(1)
  • singleHidden: wrapping with Single.create
  • plain: just subscribe
  • Concat: use concatMap to map it to a scalar (operator not available in Single)
  • Merge : use flatMap to map it to a scalar/singe
  • Switch : use switchMap to map it to a scalar (operator not available in Single)

My guess is that single is slower because that Observable.OnSubscribe vs Single.OnSubscribe wrapping game.

@akarnokd akarnokd merged commit 44947d9 into ReactiveX:1.x Jun 1, 2016
@akarnokd akarnokd deleted the OneItemPerf branch June 1, 2016 11:02
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.

1 participant