DEV Community

Discussion on: Avoid async/await hell

Collapse
 
gixxerblade profile image
Steve Clark 🤷‍♀️

...up to twice as fast because we're running all the promises in parallel

Are you sure it's running in parallel?

Collapse
 
tomdoestech profile image
Tom Nagle

It doesn't run in parallel, that would require multiple threads. Promise.all executes promises concurrently.

Collapse
 
judionit profile image
Judicaël Andriamahandry

yes, thanks, fixed it

Collapse
 
judionit profile image
Judicaël Andriamahandry

concurrently to be exact

Collapse
 
gixxerblade profile image
Steve Clark 🤷‍♀️

At a high level, Node.js falls into the category of concurrent computation. This is a direct result of the single-threaded event loop being the backbone of a Node.js application. The event-loop repeatedly takes an event and then sequentially executes all listeners interested in that event. The event loop never runs two pieces of JavaScript in parallel.
bytearcher.com/articles/parallel-v...