js arrays with capacity vs dynamic redimension

Benchmark created on


Setup

var arr1 = new Array(10);
    var arr2 = [];

Test runner

Ready to run.

Testing in
TestOps/sec
Add 10 items without redim
arr1[0] = 292289;
arr1[1] = 289;
arr1[2] = 928;
arr1[3] = 11;
arr1[4] = 743;
arr1[5] = 829;
arr1[6] = 2944442289;
arr1[7] = 11;
arr1[8] = 332;
arr1[9] = 2892898282;
ready
Add 10 items with redim
arr2.push(292289);
arr2.push(289);
arr2.push(928);
arr2.push(11);
arr2.push(743);
arr2.push(829);
arr2.push(2944442289);
arr2.push(11);
arr2.push(332);
arr2.push(2892898282);
ready

Revisions

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