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

fix(mergeMap): allow conccurent to be set as the second argument for … #1453

Closed

Conversation

david-driscoll
Copy link
Member

Description:
Allow concurrent to be supplied as the second argument for mergeMap and mergeMapTo.

Related issue (if exists):
see #1448 for discussion

Perf Details

On my machine the numbers were kind of hit or miss, so it's worth a second look by someone else as well. But the numbers look to not really be affected all that much.

---------------------------------------------------------------------------------------------------------------------------------------------------
-- BEFORE
---------------------------------------------------------------------------------------------------------------------------------------------------
                                         |                     RxJS 4.0.7 |              RxJS 5.0.0-beta.2 |          factor |      % improved
---------------------------------------------------------------------------------------------------------------------------------------------------
                    mergemap - immediate |                 1,871 (±4.96%) |                24,602 (±5.36%) |          13.15x |        1,215.2%
                                mergemap |                   575 (±4.30%) |                 3,779 (±5.71%) |           6.57x |          556.9%
---------------------------------------------------------------------------------------------------------------------------------------------------
                    mergemap - immediate |                 1,675 (±5.89%) |                20,097 (±5.73%) |          12.00x |        1,100.2%
                                mergemap |                   617 (±5.99%) |                 4,508 (±5.15%) |           7.30x |          630.5%
---------------------------------------------------------------------------------------------------------------------------------------------------
                    mergemap - immediate |                 2,300 (±3.36%) |                28,980 (±3.07%) |          12.60x |        1,159.8%
                                mergemap |                   761 (±3.28%) |                 5,644 (±3.56%) |           7.42x |          641.6%
---------------------------------------------------------------------------------------------------------------------------------------------------
-- AFTER
---------------------------------------------------------------------------------------------------------------------------------------------------
                                         |                     RxJS 4.0.7 |              RxJS 5.0.0-beta.2 |          factor |      % improved
---------------------------------------------------------------------------------------------------------------------------------------------------
                    mergemap - immediate |                 2,156 (±6.06%) |                27,358 (±5.14%) |          12.69x |        1,168.8%
                                mergemap |                   678 (±5.41%) |                 5,260 (±5.54%) |           7.75x |          675.3%
---------------------------------------------------------------------------------------------------------------------------------------------------
                    mergemap - immediate |                 1,781 (±6.55%) |                22,664 (±6.63%) |          12.72x |        1,172.4%
                                mergemap |                   589 (±4.92%) |                 4,865 (±5.04%) |           8.26x |          725.7%
---------------------------------------------------------------------------------------------------------------------------------------------------
                    mergemap - immediate |                 1,998 (±5.14%) |                26,582 (±4.79%) |          13.31x |        1,230.6%
                                mergemap |                   583 (±5.49%) |                 6,060 (±2.12%) |          10.39x |          939.2%
---------------------------------------------------------------------------------------------------------------------------------------------------

@kwonoj
Copy link
Member

kwonoj commented Mar 10, 2016

what about add type definition test in this PR as well?

@david-driscoll
Copy link
Member Author

Hadn't thought about it, added!

@kwonoj
Copy link
Member

kwonoj commented Mar 10, 2016

👍

@kwonoj
Copy link
Member

kwonoj commented Mar 10, 2016

Just tried new 'reaction' feature to your PR :)

@kwonoj
Copy link
Member

kwonoj commented Mar 11, 2016

I'll check this in around today to tomorrow if there isn't additional suggestion.

@mattpodwysocki
Copy link
Collaborator

@david-driscoll @kwonoj wait, I think this should be thought through a bit since we want to have the following:

mergeMap(source, selector, resultSelector?)
mergeMap(source, selector)

Perhaps we should break it out into its own thing such as:

mergeMapConcurrent(source, maxConcurrent, selector, resultSelector?)

@trxcllnt
Copy link
Member

@mattpodwysocki what are you saying is the source argument? we've already distinguished between mergeMap and mergeMapTo

@kwonoj kwonoj removed the PR: lgtm label Mar 11, 2016
@kwonoj
Copy link
Member

kwonoj commented Mar 11, 2016

I'll put on hold check in to clarify. Just in case, current mergeMap signature supports these.

mergeMap(project);
mergeMap(project, concurrent);
mergeMap(project, resultSelector);
mergeMap(project, resultSelector, concurrent);

@benlesh
Copy link
Member

benlesh commented Mar 14, 2016

The commit message has a typo. conccurent => concurrent

…mergeMap and mergeMapTo

This behavior is similar to how merge works
@david-driscoll
Copy link
Member Author

@Blesh fixed 😄

expectSubscriptions(inner.subscriptions).toBe(innersubs);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});

Copy link
Member

Choose a reason for hiding this comment

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

Add a test for mergeMap(selecter, resultSelector, 2) so make sure it covers that call type.

Also, go through the tests and make sure every permutation of mergeMap has been called at least once. fn, fn, fn, fn, number, and fn, fn, number

Copy link
Member Author

Choose a reason for hiding this comment

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

The result selector version is handled already above this test. As well as the single method test is handled above as well. Two methods, without concurrency isn't in there just yet, but that can be added fairly easily.

@benlesh
Copy link
Member

benlesh commented Mar 21, 2016

LGTM.

@kwonoj
Copy link
Member

kwonoj commented Mar 22, 2016

Merged with c003468, thanks @david-driscoll !

@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

5 participants