-
Notifications
You must be signed in to change notification settings - Fork 2
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 AsyncLocalStorage if available #5
Comments
@mcollina Good call! I will look into implementing this asap! |
@mcollina Am I waiting on this PR: nodejs/node#32318 ? for a backport to 12? |
@mcollina Got this implemented. I see a 33% increase in performance on average which is pretty amazing. Just waiting on the backport: https://github.com/thorough-developer/fastify-http-context/tree/async-local-storage |
I know :). I was part of the team that came up with the theory that makes it possible to be faster. |
Done #6 Added a conditional to handle whether the class was available. So 13+ and hopefully 12 soon will get the performance boost. Thanks for the suggestion |
https://nodejs.org/dist/latest-v14.x/docs/api/async_hooks.html#async_hooks_class_asynclocalstorage provides a very similar experience of cls-hooked at a fraction of the overhead. It should use that instead when/if available.
The text was updated successfully, but these errors were encountered: