3 ms·
The best part of this: The native for loop is what lodash uses. It's the fastest way to do it.
by gmmeyer 10y ago
The best part of this: The native for loop is what lodash uses. It's the fastest way to do it.
- bhouston 10y agoThe issue is the callback, it introduces significant overhead because it is a new context with its own scope on a per callback basis.
- dclowd9901 10y agoYes, exactly. I suppose if you registered the callback as a named function expression, a good js engine might be able to optimize on it and inline it, but I also don't like leaning on compilers so much.