multiple push vs push multiples (v2)

Revision 2 of this benchmark created on


Setup

var rebellion = [];
    var names = ["Luke", "Obi-Wan", "Leia", "Han", "C3PO", "R2D2", "Biggs", "Wedge"];

Teardown


    rebellion = null;
  

Test runner

Ready to run.

Testing in
TestOps/sec
push multiple
rebellion.push("Luke", "Obi-Wan", "Leia", "Han", "C3PO", "R2D2", "Biggs", "Wedge");
ready
multiple pushes
rebellion.push("Luke");
rebellion.push("Obi-Wan");
rebellion.push("Leia");
rebellion.push("Han");
rebellion.push("C3PO");
rebellion.push("R2D2");
rebellion.push("Biggs");
rebellion.push("Wedge");
ready
push apply
rebellion.push.apply(rebellion, names);
ready
push in a loop
for (var i = 0, l = names.length; i < l; i++) {
  rebellion.push(names[i]);
}
ready

Revisions

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