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

chore(DeferObservable): add benchmarks & minor perf #1393

Merged
merged 2 commits into from
Apr 8, 2016
Merged

chore(DeferObservable): add benchmarks & minor perf #1393

merged 2 commits into from
Apr 8, 2016

Conversation

tetsuharuohzeki
Copy link
Contributor

This is the benchmark result on Node v5.9.0,
MacBook Pro (Retina, 15-inch, Mid 2014, 2.8 GHz Intel Core i7, 16 GB 1600 MHz DDR3).

Before (7116d1d)

                                         |                     RxJS 4.1.0 |              RxJS 5.0.0-beta.3 |          factor |      % improved
---------------------------------------------------------------------------------------------------------------------------------------------------
                       defer - immediate |             1,117,475 (±1.08%) |             1,979,565 (±1.09%) |           1.77x |           77.1%
                                   defer |               905,413 (±1.15%) |             1,187,348 (±1.42%) |           1.31x |           31.1%

After changeset 09cd8d0

                                         |                     RxJS 4.1.0 |              RxJS 5.0.0-beta.3 |          factor |      % improved
---------------------------------------------------------------------------------------------------------------------------------------------------
                       defer - immediate |             1,070,341 (±0.96%) |             2,003,761 (±1.21%) |           1.87x |           87.2%
                                   defer |               944,100 (±1.30%) |             1,234,359 (±1.25%) |           1.31x |           30.7%

After changeset 70c3247

                                         |                     RxJS 4.1.0 |              RxJS 5.0.0-beta.3 |          factor |      % improved
---------------------------------------------------------------------------------------------------------------------------------------------------
                       defer - immediate |             1,058,502 (±1.15%) |             2,035,010 (±1.06%) |           1.92x |           92.3%
                                   defer |               914,642 (±1.26%) |             1,219,651 (±1.89%) |           1.33x |           33.3%

result.subscribe(subscriber);
}
}
}

function callObservableFactory<T>(factory: () => Observable<T>, errorSubscriber: Subscriber<T>): Observable<T> {
Copy link
Member

Choose a reason for hiding this comment

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

Can you try adding this as a member of DeferObservable? That way you don't create a closure in _subscribe to get at callObservableFactory. It probably won't make a huge difference, but I wanted to bring it up.

@tetsuharuohzeki
Copy link
Contributor Author

Can you try adding this as a member of DeferObservable?

okay. there is no regression after doing it.

                                         | RxJS 5.0.0-beta.2 |
----------------------------------------------------------------
                       defer - immediate | 2,440,423 (±0.54%) |
                                   defer | 1,471,945 (±0.44%) |

@kwonoj
Copy link
Member

kwonoj commented Mar 21, 2016

@saneyuki , appreciate for effort. Recent changes in defer to support promise as well includes changes for this PR of remove tryCatch (0cb44e1) - would you mind update this PR for benchmark test?

@tetsuharuohzeki
Copy link
Contributor Author

@kwonoj

I updated this pull request and the description.

@tetsuharuohzeki tetsuharuohzeki changed the title refactor(DeferObservable): remove to use 'tryCatch' chore(DeferObservable): add benchmarks & minor perf Mar 22, 2016
@benlesh
Copy link
Member

benlesh commented Apr 5, 2016

@saneyuki, can you flatten the last two commits?

@benlesh
Copy link
Member

benlesh commented Apr 5, 2016

Adding "Blocked" until the last two commits are flattened, Then it's good to go. Attn @kwonoj

@kwonoj
Copy link
Member

kwonoj commented Apr 5, 2016

I'll keep eye on this. 👀

@tetsuharuohzeki
Copy link
Contributor Author

@kwonoj squashed!

@kwonoj
Copy link
Member

kwonoj commented Apr 8, 2016

I tried this before check in, seeing results as below

 defer |     659,651 (±1.48%) |     603,249 (±1.83%) |      0.91x |     -8.6%

I've been experienced sometimes number shows differently on my machine only and maybe this is same cases, but would like to confirm once again. @saneyuki , would you mind provide number again with latest changes?

@tetsuharuohzeki
Copy link
Contributor Author

@kwonoj

This is the newly benchmark result (the based master is ec4f2b7)


Environment

  • Node v5.10.1
  • OSX 10.11.4
  • MacBook Pro (Retina, 15-inch, Mid 2014)
    • CPU: 2.8 GHz Intel Core i7
    • RAM: 16 GB 1600 MHz DDR3

Result

Before

                                         |                     RxJS 4.1.0 |              RxJS 5.0.0-beta.5 |          factor |      % improved
---------------------------------------------------------------------------------------------------------------------------------------------------
                       defer - immediate |             1,010,478 (±1.09%) |             1,537,480 (±1.37%) |           1.52x |           52.2%
                                   defer |               874,775 (±1.34%) |               969,339 (±1.62%) |           1.11x |           10.8%

After

                                         |                     RxJS 4.1.0 |              RxJS 5.0.0-beta.5 |          factor |      % improved
---------------------------------------------------------------------------------------------------------------------------------------------------
                       defer - immediate |             1,049,825 (±0.74%) |             1,595,495 (±1.33%) |           1.52x |           52.0%
                                   defer |               843,224 (±1.18%) |               997,643 (±1.33%) |           1.18x |           18.3%

@kwonoj kwonoj merged commit 566f46b into ReactiveX:master Apr 8, 2016
@kwonoj
Copy link
Member

kwonoj commented Apr 8, 2016

Merged with 566f46b, thanks @saneyuki for confirmation. Seems it's my machine again.

@tetsuharuohzeki tetsuharuohzeki deleted the defer branch April 8, 2016 06:29
@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants