Bind Versus Anonymous

Benchmark created on


Description

Compares bind() to anonymous function calls.

Setup

var shrink = function(p) {
      p.radius -= 1;
      if (p.radius <0) deferred.resolve();
    };
    
    var p = {radius: 100};
    var intervalID;

Teardown


    p.radius = 100;
    clearInterval(intervalID);
  

Test runner

Ready to run.

Testing in
TestOps/sec
Bind
// async test
intervalID = setInterval(shrink.bind(this, p), 0);
 
ready
Anonymous
// async test
intervalID = setInterval(function () { shrink(p) }, 0);
 
ready

Revisions

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