Test name | Executions per second |
---|---|
map | 11671.4 Ops/sec |
for | 8146.0 Ops/sec |
const xd = '323';
const arr = [], length = 10000;
let i = 0;
for(; i<length; ++i) {
arr.push(5);
}
function test(x) {
return x*x;
}
const newArr = arr.map(test);
const arr = [], length = 10000;
let k = 0;
for(; k<length; ++k) {
arr.push(5);
}
function test(x) {
return x*x;
}
let updatedItems = [];
const len = arr.length;
let p = 0;
for(; p < len; ++p)
updatedItems.push(test(p));