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

Performance ideas from the top of my head #75

Open
benjamingr opened this issue Sep 19, 2023 · 1 comment
Open

Performance ideas from the top of my head #75

benjamingr opened this issue Sep 19, 2023 · 1 comment

Comments

@benjamingr
Copy link

Here are some performance ideas based on a cursory glimpse of the code based on perf work from bluebird:

  • Store tasks in a deque instead of an array or a list
  • Trampoline async tasks and allocate fewer promises (don't allocate new promises unless needed basically)
  • Don't use a linked list for reusify, use a deque
@mcollina
Copy link
Owner

Last time I checked the current reusify implementation was the one that yielded the best results due to the reduced allocations/gc pressure. Usually linked lists or arrays store two objects, one for the node of the list and one for the properties you want to contain. Reusify collapses those into one single object, cutting in half the allocations.

I've not optimized the promise version as much so there is plenty of optimizations potential there, PRs are welcomed.

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

No branches or pull requests

2 participants