X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=busy-wait.mjs;h=eeef8fed05b791d348218e6d5971dea0da6c64d7;hb=86ae6947de386a300c696735b7bb43304245468e;hp=dd8a74f5a5c2faa69c3310b718d4542b1d7d614c;hpb=f913c68ce1ad111704f1f319706cb99e9659e236;p=benchmarks-js.git diff --git a/busy-wait.mjs b/busy-wait.mjs index dd8a74f..eeef8fe 100644 --- a/busy-wait.mjs +++ b/busy-wait.mjs @@ -45,14 +45,14 @@ async function divideAndConquerTimeoutBusyWait ( * @param intervalMs */ async function setIntervalTimeoutBusyWait (timeoutMs, intervalMs = interval) { - return new Promise(resolve => { + await new Promise(resolve => { const tries = Math.round(timeoutMs / intervalMs) let count = 0 const triesSetInterval = setInterval(() => { count++ if (count === tries) { clearInterval(triesSetInterval) - return resolve() + resolve() } }, intervalMs) }) @@ -77,6 +77,4 @@ Benchmark.suite( Benchmark.save({ file: 'busy-wait', format: 'json', details: true }), Benchmark.save({ file: 'busy-wait', format: 'chart.html', details: true }), Benchmark.save({ file: 'busy-wait', format: 'table.html', details: true }) -).catch(err => { - console.error(err) -}) +).catch(console.error)