Array push

Benchmark created on


Setup

var destination = [];
    for (var i = 0; i < 1000; i++) {
      destination.push(i);
    }
    var source = [];
    for (var i = 0; i < 1000; i++) {
      source.push(i);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Push
for (var i = 0; i < 1000; i++) {
  destination.push(source[i]);
}
ready
Extend
for (var i = 0; i < 1000; i++) {
  destination[i + 1000] = source[i];
}
ready

Revisions

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