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

Use shift instead of splice (when possible) in queue #1454

Merged
merged 1 commit into from Jul 24, 2017

Conversation

iamdoron
Copy link
Contributor

Hi,

I had some performance issues when using async.cargo with large number of tasks (batches of 10k). Changing splice(0, 1) to shift() improved it dramatically (for a batch of 10k it removed ~3 seconds from each batch).
For some reason I wasn't able to reproduce it using an example. Maybe it depends on the memory state of the process. From a simple benchmark here you can see shift is much faster than splice (I checked on Safari, Chrome & Firefox on MacOS)

@hargasinski
Copy link
Collaborator

Thanks for the PR! The change looks good to me.

@megawac
Copy link
Collaborator

megawac commented Jul 24, 2017

👍 shift is usually an order of magnitude faster than splice(0, 1)

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

Successfully merging this pull request may close these issues.

None yet

3 participants