JavaScript Scene
Published in

JavaScript Scene

JavaScript Quick Tip — Avoid Serial Request Waterfalls

One gotcha that comes up frequently and has a serious impact on application performance is the tendency to accidentally fetch data in serial that could have been fetched in parallel. Don’t just drop an await in everywhere you use promises. Instead, think about the fetching dependencies. If you’re fetching more than one thing, make sure you fetch in parallel whenever you can. This will make a huge difference in your application’s performance.

Here’s some example code for you to play with.

Eric Elliott is a tech product and platform advisor, author of “Composing Software”, cofounder of EricElliottJS.com and DevAnywhere.io, and dev team mentor. He has contributed to software experiences for Adobe Systems, Zumba Fitness, The Wall Street Journal, ESPN, BBC, and top recording artists including Usher, Frank Ocean, Metallica, and many more.

He enjoys a remote lifestyle with the most beautiful woman in the world.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store