Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
Chrome 96
Windows
Desktop
3 years ago
Test name Executions per second
delayA 91218.3 Ops/sec
delayT 88045.9 Ops/sec
setTimeout 396616.0 Ops/sec
Script Preparation code:
AخA
 
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;
}
Tests:
  • delayA

    x
     
    (async function(){
      await delayA(0);
      test();
      return;
    })();
  • delayT

     
    (async function(){
      await delayT(test,0);
      return;
    })();
  • setTimeout

     
    (async function(){
      setTimeout(test,0);
    })();