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

perf(switchMapTo): remove tryCatch/errorObject (~2x improvement) #1306

Closed
wants to merge 2 commits into from

Conversation

luisgabriel
Copy link
Contributor

Before:

                                       |     RxJS 4.0.7 | RxJS 5.0.0-beta.1 | factor | % improved
--------------------------------------------------------------------------------------------------
switchmapto-resultselector - immediate | 1,695 (±1.02%) |   12,229 (±1.15%) |  7.21x |     621.3%
               switchmapto - immediate | 2,910 (±0.80%) |   32,560 (±0.99%) | 11.19x |   1,018.8%
            switchmapto-resultselector | 2,621 (±0.87%) |   12,473 (±0.49%) |  4.76x |     375.9%
                           switchmapto | 3,300 (±2.11%) |   15,433 (±0.57%) |  4.68x |     367.7%

After:

                                       |     RxJS 4.0.7 | RxJS 5.0.0-beta.1 | factor | % improved
--------------------------------------------------------------------------------------------------
switchmapto-resultselector - immediate | 1,645 (±2.07%) |   28,788 (±5.21%) | 17.50x |   1,650.5%
               switchmapto - immediate | 3,056 (±0.65%) |   31,656 (±1.17%) | 10.36x |     936.0%
            switchmapto-resultselector | 2,793 (±0.54%) |   14,322 (±1.15%) |  5.13x |     412.7%
                           switchmapto | 3,381 (±4.13%) |   15,969 (±3.86%) |  4.72x |     372.2%

Results on a Intel Core i7-3770 (Ivy Bridge) running Ubuntu:

                                       |     RxJS 4.0.7 | RxJS 5.0.0-beta.1 | factor | % improved
--------------------------------------------------------------------------------------------------
switchmapto-resultselector - immediate | 1,695 (±1.02%) |   12,229 (±1.15%) |  7.21x |     621.3%
               switchmapto - immediate | 2,910 (±0.80%) |   32,560 (±0.99%) | 11.19x |   1,018.8%
            switchmapto-resultselector | 2,621 (±0.87%) |   12,473 (±0.49%) |  4.76x |     375.9%
                           switchmapto | 3,300 (±2.11%) |   15,433 (±0.57%) |  4.68x |     367.7%
} else {
destination.next(innerValue);
}
}

private trySelectResult(outerValue: T, innerValue: R,
Copy link
Member

Choose a reason for hiding this comment

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

Small thing: can this be tryResultSelector since it matches up to resultSelector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

Before:
                                       |     RxJS 4.0.7 | RxJS 5.0.0-beta.1 | factor | % improved
--------------------------------------------------------------------------------------------------
switchmapto-resultselector - immediate | 1,695 (±1.02%) |   12,229 (±1.15%) |  7.21x |     621.3%
               switchmapto - immediate | 2,910 (±0.80%) |   32,560 (±0.99%) | 11.19x |   1,018.8%
            switchmapto-resultselector | 2,621 (±0.87%) |   12,473 (±0.49%) |  4.76x |     375.9%
                           switchmapto | 3,300 (±2.11%) |   15,433 (±0.57%) |  4.68x |     367.7%

After:
                                       |     RxJS 4.0.7 | RxJS 5.0.0-beta.1 | factor | % improved
--------------------------------------------------------------------------------------------------
switchmapto-resultselector - immediate | 1,645 (±2.07%) |   28,788 (±5.21%) | 17.50x |   1,650.5%
               switchmapto - immediate | 3,056 (±0.65%) |   31,656 (±1.17%) | 10.36x |     936.0%
            switchmapto-resultselector | 2,793 (±0.54%) |   14,322 (±1.15%) |  5.13x |     412.7%
                           switchmapto | 3,381 (±4.13%) |   15,969 (±3.86%) |  4.72x |     372.2%
@luisgabriel
Copy link
Contributor Author

@Blesh done.

@benlesh
Copy link
Member

benlesh commented Feb 5, 2016

LGTM

@kwonoj
Copy link
Member

kwonoj commented Feb 6, 2016

Merged with c8cf72a, thanks @luisgabriel

@kwonoj kwonoj closed this Feb 6, 2016
@luisgabriel luisgabriel deleted the switchMapTo-perf branch February 7, 2016 00:13
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants