Re:I Avoid Async/Await
by madeofpalk on Saturday April 16, 2022 @07:57AM
(#31051615)
One thing I really like async/await for is you can use them in for-loops. It makes it significantly easier to do async work in what was previously very synchronous.
[ Parent
| on HN ]
I thought await in loops was a big no no, unless it has changed since I last checked?
Doesn’t it remove any opportunity for parallelism, making the loop take much longer than it would with a Promise.all?
Or am I missing something?
Re:I Avoid Async/Await
by madeofpalk on Saturday April 16, 2022 @01:48PM
(#31054368)
You're right(ish) - the async functions would not run in parallel. But sometimes that's either fine, or I don't want them to run in parallel.
It’s funny; I never thought of it as a desirable behaviour.
To each their own!