Important to mention that, although it looks cleaner, easier to read and everything, mainly for new developers, using async/await may trick you into not seeing points of opportunity for parallelism and you end up with a series of asynchronous call being treated as a plain synchronous code. For that cases where's there's in no need wait for things to be ran sequentially, Promise.all to the rescue!
I don't really agree with this. You can make the same mistake with promises or async/await. You can still chain the promises instead of calling them in parallel
You surely can. My point here is not to confuse new devs making them think one replaces the other, because it doesn't. They are two tools you can combine to make the best out of your async flows.
Good post, by the way!
Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
Yeah, I do that myself (I don't think that's gross at all). That's the combination I think makes sense: we get the benefits of async/await without giving up the parallelism.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Important to mention that, although it looks cleaner, easier to read and everything, mainly for new developers, using
async/await
may trick you into not seeing points of opportunity for parallelism and you end up with a series of asynchronous call being treated as a plain synchronous code. For that cases where's there's in no need wait for things to be ran sequentially,Promise.all
to the rescue!I don't really agree with this. You can make the same mistake with promises or async/await. You can still chain the promises instead of calling them in parallel
You surely can. My point here is not to confuse new devs making them think one replaces the other, because it doesn't. They are two tools you can combine to make the best out of your async flows.
Good post, by the way!
tbh I tend to get a little weird with parallel promises and combine destructuring,
await
, andPromise.all()
:kinda gross, but personally I prefer it to returning to promise chains
Yeah, I do that myself (I don't think that's gross at all). That's the combination I think makes sense: we get the benefits of
async/await
without giving up the parallelism.