4 ms·
It's fairly well-known that Array#forEach is up to an order of magnitude slower than a for-loop, across browsers. The usual reason given is the overhead of inv
by dgreensp 12y ago
It's fairly well-known that Array#forEach is up to an order of magnitude slower than a for-loop, across browsers. The usual reason given is the overhead of invoking a closure from the VM. A JS implementation of forEach ought to be somewhere in the middle.
The speed-up for "concat" is surprising to me. I wonder if it holds for "splice" and if that is true across browsers.
- nijiko 12y agoAnd it can be made even faster ;) http://jsperf.com/fast-iter http://jsperf.com/fast-iter