Test name | Executions per second |
---|---|
asyncFor | 6836718.5 Ops/sec |
asyncPromiseAll | 2338922.2 Ops/sec |
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))
));
}
asyncFor()
asyncPromiseAll()