Lodash or undescorejs provides methods for manipulating objects and collections, and other utilities, functions.
How does it take care of performance? or is it good practice to write your own javascript for that ?
How does lodash or underscore take care of performance
please enlight me on this,
Thanks,

- 7,722
- 1
- 13
- 17
-
Possible duplicate of [Differences between lodash and underscore](http://stackoverflow.com/questions/13789618/differences-between-lodash-and-underscore) – mikeapr4 Feb 22 '17 at 11:23
-
http://stackoverflow.com/a/13869090/1084004 – mikeapr4 Feb 22 '17 at 11:24
2 Answers
Both libraries are very mature, well tested, and have excellent browser coverage - ie: they are battle tested. I know lodash in particular is constantly trying to refine and refine their performance.
Performance, you will probably have a very hard time getting close to them while maintaining browser coverage. If you have a very very particular data set, where your own library would have "insider knowledge" on how to manipulate it, then sure, maybe your library might trump lodash/underscore.
If you are concerned about file size (in terms of performance), remember lodash allows importing sub modules. For example: https://www.npmjs.com/package/lodash.isnil

- 54,599
- 30
- 149
- 186
There are several blogs talking about this subject, check this: https://benmccormick.org/2014/11/12/underscore-vs-lodash/ and https://zombiecodekill.com/2015/10/18/underscore-and-lodash/.
In my honest opinion you shouldn't "reinvent the wheel", why create your functions instead of using an existing library, well tested and with a big community improving it every release?

- 2,335
- 2
- 19
- 31