doc: add explanation why keep var with for loop in async_hooks#30380
doc: add explanation why keep var with for loop in async_hooks#30380lrecknagel wants to merge 1 commit intonodejs:masterfrom
Conversation
Refs: nceu19-async_hooks This comment will help contributors to understand why keeping var
|
Welcome, @lrecknagel and thanks for the pull request. I'm guessing this is from a Code + Learn event. I'm not sure the " |
|
This is an extremely tight loop in a code path that is hit a lot. |
Cool. Let's see if we can get that information into the comment. As it reads now, it could encourage someone to go through and change all |
|
I left two optional suggestions. It will save someone a little bit of |
This comment will help contributors to understand why keeping var PR-URL: #30380 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
|
landed in 4506991 |
This comment will help contributors to understand why keeping var PR-URL: #30380 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This comment will help contributors to understand why keeping var PR-URL: #30380 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This comment will help contributors to understand why keeping var PR-URL: #30380 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
|
👋 Just passing by here and I was curious so I ran some benchmarks if anyone is curious about this. At the time of Node.js 6 it was a real performance gain but nowadays it's almost the same |

Refs: nceu19-async_hooks
This comment will help contributors to understand why keeping var in some for loop instead changing at to let, as discussed with @mcollina
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes