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 1 commit into from Jul 24, 2017


Copy link

@iamdoron iamdoron commented Jul 21, 2017


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)

Copy link

@hargasinski hargasinski commented Jul 23, 2017

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

Copy link

@megawac megawac commented Jul 24, 2017

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

@megawac megawac merged commit fa206af into caolan:master Jul 24, 2017
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants