3 ms·
Here's a jsperf of fast.js / lodash / native: http://jsperf.com/fast-vs-lodash http://jsperf.com/fast-vs-lodash
by jrajav 12y ago
Here's a jsperf of fast.js / lodash / native: http://jsperf.com/fast-vs-lodash http://jsperf.com/fast-vs-lodash
- phpnode 12y agothanks for this! it looks like there's some room for improvement in the .map / .forEach implementations but the rest seems to stack up pretty well.
- bzbarsky 12y agoThe native bind in Firefox is much faster than the fast.js one (not surprising, since it has explicit JIT support).
- megawac 12y agoFixed the rawgit link to use the rawgit cdn http://jsperf.com/fast-vs-lodash/3 http://jsperf.com/fast-vs-lodash/3
- bzbarsky 12y agoThanks for that. So looking at this in Firefox, the "fast" version underperforms the native one for forEach, bind, map, reduce, and concat. It outperforms native for indexOf/lastIndexOf. In Chrome the "fast" version does better than the native one for indexOf, lastIndexOf, forEach, map, and reduce. It does worse on bind and concat. It's interesting to compare the actual numbers across the browsers too. In Firefox, the numbers I see for forEach are: "fast": 47,688 native: 123,187 and the Chrome ones are: "fast": 71,070 native: 20,112 Similarly, for map in Firefox I see: "fast": 17,532 native: 62,268 and in Chrome: "fast": 38,286 native: 19,521 Interestingly, these two methods are actually implemented in self-hosted JS in both SpiderMonkey and V8, last I checked, so this is really comparing the performance of three different JS implementations.
- garthk 12y agoThanks for that. I can tell the young pups to calm down.
- cel1ne 12y agoNative bind in Safari is much faster. bind - fast 2,565,227 ±2.19% bind - lodash 4,923,373 ±1.51% bind - native 9,022,396 ±2.12% on iPad this difference is even larger.