Test name | Executions per second |
---|---|
asyncFor | 3118235.2 Ops/sec |
asyncPromiseAll | 1073934.8 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()