Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Chrome 133
Mac OS X 10.15.7
Desktop
one month ago
Test name Executions per second
asyncFor 6836718.5 Ops/sec
asyncPromiseAll 2338922.2 Ops/sec
Script Preparation code:
x
 
async function asyncFor(){
    for (const x of [1, 2, 3]) {
        await new Promise(resolve => resolve(x > 0));
    }
}
async function asyncPromiseAll() {
    await Promise.all([1, 2, 3].map(x =>
        new Promise(resolve => resolve(x > 0))
    ));
}
Tests:
  • asyncFor

     
    asyncFor()
  • asyncPromiseAll

     
    asyncPromiseAll()