bound apply vs cached vs full property resolution

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var _push_apply = Function.prototype.apply.bind(Array.prototype.push);
    var _push = Array.prototype.push;
   
    var obj;
   
    var to_push = [1,2,3,4,5];
};
</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
bound push
var obj = {length:0};

_push_apply(obj, to_push);
pending…
cached push
var obj = {length:0};

_push.apply(obj, to_push);
pending…
full property resolution
var obj = {length:0};

Array.prototype.push.apply(obj, to_push);
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