



Planted:
Status: decay
Performance is mostly effected by choosing a declarative or imperative programming approach:
Array methods .forEach, .reduce and .map are declarative.for..of and for loops.Below is the performance of different looping approaches for 3 common tasks; for each, map, and reduce.

for..of and for loops have approx. the same performance for arrays.push automatic growth (see Map example).This makes sense when you break down what each approach is doing:
for loop:i < array.lengthi++for..of loop:const item
Don't prematurally optimize. When iterating data, selecting an approach shouldn't be based on performance only. Performance is just 1 variable that needs to be considered with others, such as:
Have any feedback about this note or just want to comment on the state of the economy?

