Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
* @param intervalMs
*/
async function setIntervalTimeoutBusyWait (timeoutMs, intervalMs = interval) {
- return await 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)
})
/**
*
*/
-async function promise () {
- return await new Promise(resolve => {
+async function asyncFunction () {
+ await new Promise(resolve => {
resolve()
})
}
-/**
- *
- */
-async function asyncFunction () {
- return await promise()
-}
-
Benchmark.suite(
'Promise handling',
Benchmark.add('await promise', async () => {