Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Chrome 53
Linux
Other
8 years ago
Test name Executions per second
new Array 27.0 Ops/sec
brackets 62.7 Ops/sec
brackets with length 38.4 Ops/sec
Script Preparation code:
x
 
var arraySize = 10000;
var iterations = arraySize + 100;
var data;
var operate = function(){
  for(var index = 0; index < iterations; index++){
     data.unshift({});
    if(data.length > arraySize) data.pop();
  }
}
Tests:
  • new Array

     
    data = new Array(arraySize);
    operate();
  • brackets

     
    data = [];
    operate();
  • brackets with length

     
    data = [];
    data.length=arraySize;
    operate();