Test name | Executions per second |
---|---|
filter | 3694519.0 Ops/sec |
forEach | 2513979.0 Ops/sec |
var arr = [];
for(i=0; i<100; i++){
Math.random() > .5 ? arr.push({is_group: true}) : arr.push({is_group: false})
}
const a = arr.filter(i => i.is_group)
const a = [];
const b = [];
arr.forEach(i => {
if (i.is_group) {
a.push(i)
} else {
b.push(i)
}
})