Array Assignment vs Array Push (v10)

Revision 10 of this benchmark created by bluefireuoop on


Description

You've heard the rumors - now here's the proof.

Test runner

Ready to run.

Testing in
TestOps/sec
arrayA[arrayA.length] = 'foo';
var arrayA = [];
for (var i = 0; i < 2000; i++) {
  arrayA[arrayA.length] = 'foo';
}
ready
arrayB.push('foo');
var arrayB = [];
for (var i = 0; i < 2000; i++) {
  arrayB.push('foo');
}
ready
arrayC[i] = 'foo';
//var arrayC = [];
for (var i = 0; i < 2000; i++) {
  arrayC[i] = 'foo';
}
ready

Revisions

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