Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
sync for vs promise.all vs async for
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
syncFor
12798734.0 Ops/sec
asyncPromiseAll
288129.1 Ops/sec
asyncFor
1681272.8 Ops/sec
Script Preparation code:
function syncFor() { let y = 0; for (const x of [1, 2, 3, 4, 5, 6, 7, 8, 9]) { y += x; } } async function asyncFor() { let y = 0; for (const x of [1, 2, 3, 4, 5, 6, 7, 8, 9]) { await new Promise((resolve) => { y += x; resolve(y); }); } } async function asyncPromiseAll() { let y = 0; await Promise.all([1, 2, 3, 4, 5, 6, 7, 8, 9].map(x => new Promise((resolve) => { y += x; resolve(y); }), )); }
Tests:
syncFor
syncFor()
asyncPromiseAll
asyncPromiseAll()
asyncFor
asyncFor()