Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

for the record sprinkling await everywhere is not something you should take lightly. await is still probably the single most high-level high-overhead construct in JS, and putting it inside tight loops is a recipe for perf disaster


Depends what you are waiting for.

Maybe an in memory cache hit---that you explicitly code---causes a sync resolve to happen, woohoo!

But if it goes to IO and you are waiting for the event loop to schedule you back in you could be in for a shock even if the IO op is tiny. Especially doing it alot.

Only matters probably on a high CPU usage server which hopefully you avoid by scaling up on cpu and using all the cores.

On the other hand... you are being cooperative :)

But tight loop IO is an antipattern ... as is doing a lot---millions---of IO ops from node (per request or job) that you need to worry about this (use a different language for your DB server!).




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: