Has anybody done benchmarking, or can link to an article on this subject? Particularly interested in IE results, since usually JS performance is not a problem in other browsers.
I would like to know how much slower it is to do something like:
var numbers = [1, 2, 3, 4, 5, 6, 7];
var results = numbers.map(function() {
// do some stuff
});
instead of the typical:
var numbers = [1, 2, 3, 4, 5, 6, 7];
var results = [];
for (var i = 0; i < numbers.length; i++) {
var number = numbers[i];
var result;
// do some stuff
results.push(result);
}
I obviously prefer the functional style, but I assume the extra overhead of calling an extra function for each item could slow things down with big collections.
Thanks!