Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
Performance difference between returning two `Promise` results from a `Promise.all` vs in the `await`-ing in the `return` itself

Consider the following two approaches:

// approach 1
const someFunc = async () => {
    const [responseA, responseB] = await Promise.all([
        someQuery({ param: 'abc' }),
        someQuery({ param: '123' }),
    ])

    return {
        responseA,
        responseB,
    }
}
// approach 2
const someFunc = async () => {
    return {
        responseA: await someQuery({ param: 'abc' }),
        responseB: await someQuery({ param: '123' })
    }
}

Would these two approaches respond with the same speed? I presume that the Promise.all approach would be a bit faster, because it awaits all promises before responding.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!