Array 0...N-1

JavaScript performance comparison

Test case created by thisBrian

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Array.from(Array(N), map)
let arr = Array.from(Array(100), (val, i) => i);
pending…
Array.from(Array(N)).map
let arr = Array.from(Array(100)).map((val, i) => i);
pending…
Array.from({N}, map)
let arr = Array.from({length:100}, (val, i) => i);
pending…
Array.from({N}).map
let arr = Array.from({length:100}).map((val, i) => i);
pending…
[...Array(N)].map
let arr = [...Array(100)].map((val, i) => i);
pending…
[...Array(N).keys]
let arr = [...Array(100).keys()];
pending…
Array.apply.map
let arr = Array.apply(null, {
  length: 100
}).map((val, i) => i);
pending…
ForLoop
let arr = [];
for (let i = 0; i < 100; i++) {
  arr.push(i)
};
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.

0 Comments