Push vs length (v13)

Revision 13 of this benchmark created by Jerome on


Test runner

Ready to run.

Testing in
TestOps/sec
length
var myArray = [];
myArray[myArray.length] = 'foo';
myArray[myArray.length] = 'bar';
myArray[myArray.length] = 'bar';
myArray[myArray.length] = 'bar';
myArray[myArray.length] = 'bar';
myArray[myArray.length] = 'bar';
myArray[myArray.length] = 'bar';
ready
push
var myArray = [];
myArray.push('foo');
myArray.push('bar');
myArray.push('bar');
myArray.push('bar');
myArray.push('bar');
myArray.push('bar');
myArray.push('bar');
ready
cache length
var myArray = [];
var len=myArray.length;
myArray[len] = 'foo';
myArray[len++] = 'bar';
myArray[len++] = 'bar';
myArray[len++] = 'bar';
myArray[len++] = 'bar';
myArray[len++] = 'bar';
myArray[len++] = 'bar';
ready

Revisions

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