More arguments.callee (v2)

Revision 2 of this benchmark created by Wojciech Dłubacz on


Description

Checking for function inlining

Preparation HTML

<div id='r'></div>

Setup

function doStuff(f) {
      var i, x;
      for (i = 0; i < 10000; ++i) {
        x += f(i);
      }
      return x;
    }
    function doStuffS(f) {
      "use strict";
      var i, x;
      for (i = 0; i < 10000; ++i) {
        x += f(i);
      }
      return x;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
With arguments.callee
function a(i) {
  if (arguments.callee.foo)
    return i * 2;
  return i;
}
document.getElementById('r').innerHTML = doStuff(a);
 
ready
Without arguments.callee
function b(i) {
  if (b.foo)
    return i * 2;
  return i;
}
document.getElementById('r').innerHTML = doStuff(b);
 
ready
Withour arguments.callee + strict mode
function b(i) {
  "use strict";
  if (b.foo)
    return i * 2;
  return i;
}
document.getElementById('r').innerHTML = doStuffS(b);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 2: published by Wojciech Dłubacz on