Range-style vs explicit arrays

JavaScript performance comparison

Test case created

Info

Comparing the performance of different forms of array initialization.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Range-style
var a = Array.apply(null, {length: 20});
pending…
literal
var a = [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined];
pending…
for loop
var a = [];
for (var i = 0; i < 20; i++) {
    a[i] = undefined;
}
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