binds

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    //js binding
    Function.prototype.bindx=function(t){
        var ags=Array.prototype.slice.call(arguments,1);
        var k=this.valueOf();
        return function(){
                var ags2=Array.prototype.slice.call(arguments);
                return k.apply(t, ags.concat(ags2));
        }
    }
    function aa(a,b){
    return [a,b];
    }
    var a=aa.bindx(1);
    var b=aa.bind(1);
};
</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 method
b(2);
pending…
Self-defined bind method
a(2);
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