Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Promise vs Async Await(2)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0
Browser:
Firefox 135
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Promise Chain
204986.5 Ops/sec
Async Await
197922.0 Ops/sec
Promise.all
18656.2 Ops/sec
Promise Chain normal
29457.3 Ops/sec
Script Preparation code:
function executePromises() { const vals = []; Promise.resolve(1) .then((val) => { vals.push(val); return Promise.resolve(2); }) .then((val) => { vals.push(val); return Promise.resolve(3); }) .then((val) => { vals.push(val); return Promise.resolve(4); }) .then((val) => { vals.push(val); return Promise.resolve(5); }) .then((val) => { vals.push(val); return Promise.resolve(6); }) .then((val) => { vals.push(val); console.log(vals); }); } function executePromises2() { const vals = []; Promise.resolve(1) .then((val) => { vals.push(val); return 2; }) .then((val) => { vals.push(val); return 3; }) .then((val) => { vals.push(val); return 4; }) .then((val) => { vals.push(val); return 5; }) .then((val) => { vals.push(val); return 6; }) .then((val) => { vals.push(val); console.log(vals); }); } async function executeAwaits() { const vals = []; vals.push(await Promise.resolve(1)); vals.push(await Promise.resolve(2)); vals.push(await Promise.resolve(3)); vals.push(await Promise.resolve(4)); vals.push(await Promise.resolve(5)); vals.push(await Promise.resolve(6)); console.log(vals); } function executePromiseAll() { Promise.all([Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)]).then( (vals, rej) => { console.log(vals); } ); }
Tests:
Promise Chain
executePromises();
Async Await
executeAwaits();
Promise.all
executePromiseAll();
Promise Chain normal
executePromises2();