Array direct assignment vs push (v84)

Revision 84 of this benchmark created on


Setup

var array = [],
    i=0;

Test runner

Ready to run.

Testing in
TestOps/sec
Direct assignment
array[i] = "test";
i++;
 
ready
Push
array.push("test");
ready
Direct assignment (calculated)
array[array.length - 1] = "test";
ready
Direct assignment (length)
array[array.length] = "test";
ready

Revisions

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