shlogg · Early preview
Tanishq510 @tanishq510

Boost App Performance: Ditch Await For Promise.all()

Rethink async calls! Using await for multiple API calls can slow down your app. Try `Promise.all()` to process them concurrently and boost performance!

"Why this list render is taking so long??"
Hey Devs,
If you are relying too much on await for your async calls, then it's time to think if you are trading your app performance.
Observe this code below:

const result1 = await asyncFunction1(); // 1 second
const result2 = await asyncFunction2();// 1 second
const result3 = await asyncFunction3();// 1 second


    
    

    
    




The code looks okay for the first time, but the code execution is getting stopped for 1 second at each await.And going to take 3 seconds to process the code block
This particular code block is going to take 3 seconds...