Test name | Executions per second |
---|---|
delayA | 91218.3 Ops/sec |
delayT | 88045.9 Ops/sec |
setTimeout | 396616.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();
return;
})();
(async function(){
await delayT(test,0);
return;
})();
(async function(){
setTimeout(test,0);
})();