Test name | Executions per second |
---|---|
Functional | 33453.0 Ops/sec |
Imperative | 231100.0 Ops/sec |
window.nums = new Array(1000).fill(0).map((x,i) => i)
const y = nums.filter(x => x%2).map(x => x*3).filter(x => x < 100)
return y
const y = []
for(const x of nums) {
if(x%2) {
const x3 = x*3;
if(x3 < 100) {
y.push(x3)
}
}
}
return y