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

Improve performance #47

Merged
merged 1 commit into from
Nov 25, 2020
Merged

Improve performance #47

merged 1 commit into from
Nov 25, 2020

Conversation

sindresorhus
Copy link
Owner

@sindresorhus sindresorhus commented Nov 24, 2020

By using a queue data structure.

Closes #46

@neverendingqs
Copy link

LGTM. FYI, running the same perf scenario in #46 results in a runtime of ~340 ms.

const limit = plimit(10000000);
const start = Date.now();
await Promise.all([...Array(100000)].map(_ => limit(async () => Promise.resolve())));
console.log(Date.now() - start, 'plimit');

@sindresorhus
Copy link
Owner Author

The extra 40ms is probably because I'm using classes and yallist uses plain functions. Doesn't matter though. V8 will eventually make it as fast or faster.

@sindresorhus sindresorhus merged commit 54c0ba8 into master Nov 25, 2020
@sindresorhus sindresorhus deleted the performance branch November 25, 2020 07:28
@sindresorhus
Copy link
Owner Author

Thanks for bringing this up and testing 🙌🏻

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

Successfully merging this pull request may close these issues.

2 participants