Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0
Firefox 58
Windows 7
Other
2025 years ago
Test name Executions per second
delayA 76392.2 Ops/sec
delayT 68853.5 Ops/sec
setTimeout 142249.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();
    })();
  • delayT

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

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