Deferrable Test with or without bind

JavaScript performance comparison

Test case created by Ulric Wilfred

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
deferrable w/o bind
function deferrable(f) { // выберите название поприятнее
  return function() {
    return (function(f, args) {
      return function() { return f.apply(null, args); };
    })(f, arguments);
  }
}

for (var i = 0; i < 20000; i++) {
  deferrable(function(a) { a++; })(10)();
}
pending…
deferrable with bind
function deferrable( f ) {
  return function() {
    Array.prototype.unshift.call(arguments, null);
    return f.bind.apply(f, arguments); 
  }
}

for (var i = 0; i < 20000; i++) {
  deferrable(function(a) { a++; })(10)();
}
pending…

Compare results of other browsers

Revisions

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

0 Comments