Test name | Executions per second |
---|---|
Set length to zero | 21994.0 Ops/sec |
Splice | 20025.0 Ops/sec |
var size = 10000;
var arr2 = [];
for (var i = 0; i < size; i++){
arr2.push(i);
}
arr2.length = 0;
var size = 10000;
var arr3 = [];
for (var i = 0; i < size; i++){
arr3.push(i);
}
arr3.splice(0);