[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Type...
(edit): Yeah, the abstraction overhead is ridiculous. Here's the forEach() benchmark again, compared to an explicit for loop (no function calls):
// new benchmark in bench/for-each.js
exports['explicit iteration'] = function() {
acc = 0;
for (var j=0; j<input.length; ++j) {
acc += input[j];
}
}
Native .forEach() vs fast.forEach() vs explicit iteration
✓ Array::forEach() x 2,101,860 ops/sec ±1.50% (79 runs sampled)
✓ fast.forEach() x 5,433,935 ops/sec ±1.12% (90 runs sampled)
✓ explicit iteration x 28,714,606 ops/sec ±1.44% (87 runs sampled)
Winner is: explicit iteration (1266.15% faster)
(I ran this on Node "v0.11.14-pre", fresh from github).