concat-vs-push

Benchmark created by Xavier on


Test runner

Ready to run.

Testing in
TestOps/sec
Concat
var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  arrayLength,
  i;

for (i = 0, arrayLength = array.length; i < 100; i += 1) {
  array.concat([11, 12, 13, 14, 15]);
}
ready
Push
var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  arrayLength,
  i,
  j;

for (i = 0, arrayLength = array.length; i < 100; i += 1) {
  for (j = 1; j < 6; j += 1) {
    array.push(j);
  }
}
ready

Revisions

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