Test name | Executions per second |
---|---|
delayA | 76392.2 Ops/sec |
delayT | 68853.5 Ops/sec |
setTimeout | 142249.0 Ops/sec |
const delayA = time => new Promise(res=>setTimeout(res,time));
const delayT = (func, wait) => {
var args = slice.call(arguments, 2);
return setTimeout(function(){
return func.apply(null, args);
}, wait);
};
var test = function(){
return;
}
(async function(){
await delayA(0);
test();
})();
(async function(){
delayT(test,0);
})();
(async function(){
setTimeout(test,0);
})();