bind-no-args

JavaScript performance comparison

Test case created by Andrea Giammarchi

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function callback(c, d) {
      return this.a + this.b + c + d;
    }
    var object = {a: 1, b: 2};
    var bind = callback.bind(object);
    var shim = function(context){
      var fn = this;
      return function () {
        return fn.apply(context, arguments);
      };
    }.call(callback, object);
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
bind
if (bind(3, 4) !== 10) throw new Error;
pending…
shim
if (shim(3, 4) !== 10) throw new Error;
pending…

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

Compare results of other browsers

0 comments

Add a comment