Push vs length (v27)

Revision 27 of this benchmark created by Roland Pihlakas on


Test runner

Ready to run.

Testing in
TestOps/sec
length
var myArray = [];
myArray[myArray.length] = 'foo';
myArray[myArray.length] = 'bar';
ready
push
var myArray = [];
myArray.push('foo');
myArray.push('bar');
ready
var myArray = [];
function customPush(arr, item) {
    arr[arr.length] = item;
}
customPush(myArray, 'foo');
customPush(myArray, 'bar');
ready

Revisions

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