Serial and Parallel Promise in JavaScript


If you have a series of Promises to resolve, consider running them in parallel to save time.

Promises in Serial

Overall this is sequential and takes 5 second

Promises in Parallel

This example only take 2 seconds. Although the execution may be slow overall time efficiency is better.

Overall Difference

No comments: