This is not GitHub.com

Like what you see? Install OctoLinker now!

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

Add support for multiple pMapSkip's #52

Merged

Conversation

@ferrinweb
Copy link
Contributor

@ferrinweb ferrinweb commented Sep 30, 2021

like this:

console.log(await pMap([1, pMapSkip, 2, pMapSkip, 3], async value => value)) // [1, 2, 3]
@sindresorhus
Copy link
Owner

@sindresorhus sindresorhus commented Oct 3, 2021

@huntharo Would you be willing to help review?

Loading

Copy link
Contributor

@huntharo huntharo left a comment

I think we need to address the O(n^2) complexity on the number of pMapSkip items and fix the existing performance issue with the usage of .splice() in a loop.

I left an example of how to test the performance and how to change the .unshift() usage back to .push() with a loop that does a .pop() (using the array as a O(1) stack). The only remaining work would be to implement the super splice loop that loops through result only a single time and touches each item only a single time.

Loading

index.js Outdated Show resolved Hide resolved
Loading
test.js Show resolved Hide resolved
Loading
index.js Outdated Show resolved Hide resolved
Loading
index.js Outdated Show resolved Hide resolved
Loading
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
@sindresorhus sindresorhus changed the title Add support for multiple pMapSkips Add support for multiple pMapSkips Nov 2, 2021
@sindresorhus sindresorhus changed the title Add support for multiple pMapSkips Add support for multiple pMapSkip's Nov 2, 2021
@sindresorhus sindresorhus merged commit 94eb532 into sindresorhus:main Nov 2, 2021
3 checks passed
Loading
@sindresorhus
Copy link
Owner

@sindresorhus sindresorhus commented Nov 2, 2021

Thanks :)

Loading

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

Successfully merging this pull request may close these issues.

None yet

3 participants