Array direct assignment vs push (v15)

Revision 15 of this benchmark created by Jonas Finnemann Jensen on


Setup

var values = [];
    var count = 10000;

Test runner

Ready to run.

Testing in
TestOps/sec
Direct assignment
values = [];
for(var i = 0; i < count; i++) {
    values[i] = i;
}
ready
Push
values = [];
for(var i = 0; i < count; i++) {
    values.push(i);
}
ready

Revisions

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