push vs preallocated array

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
predefined
var a = new Array(1000000)
for (var i = 0; i < 1000000; i++) {
  a[i] = i
}
ready
push
var a = []
for (var i = 0; i < 1000000; i++) {
  a.push(i)
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.