array.proto vs []

JavaScript performance comparison

Revision 4 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var args = [1, 2, 3, 4, 5],
        slice = [].slice,
        slice2 = Array.prototype.slice,
        result;
};
</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
Array proto
result = Array.prototype.slice.call(args);
pending…
[]
result = [].slice.call(args);
pending…
slice
result = slice.call(args);
pending…
slice2
result = slice2.call(args);
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. Here’s a list of current revisions for this page:

0 comments

Add a comment