Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
async for vs promise.all vs promise.allSettled
(version: 0)
Comparing performance of:
asyncFor vs asyncPromiseAll vs promiseAllSettled
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
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)) )); } async function asyncPromiseAllSettled() { await Promise.allSettled([1, 2, 3].map(x => new Promise(resolve => resolve(x > 0)) )); }
Tests:
asyncFor
asyncFor()
asyncPromiseAll
asyncPromiseAll()
promiseAllSettled
asyncPromiseAllSettled()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
asyncFor
asyncPromiseAll
promiseAllSettled
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
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
Browser/OS:
Chrome 133 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
asyncFor
2668957.5 Ops/sec
asyncPromiseAll
944304.1 Ops/sec
promiseAllSettled
931764.7 Ops/sec
Related benchmarks:
map vs forEach Chris
fill array with value: map(callback) vs fill(value)
Array from() vs Map.keys() vs Map.values() vs spread
Array from() vs Map.keys() vs Map.values() vs spread (fixed)
Map.forEach vs Array.forEach vs Array.from(Map.prototype.values()).forEach
Comments
Confirm delete:
Do you really want to delete benchmark?