[Performance] Lodash vs ES6 : map()
This experiment is designed to find out the performance and resource usage of map functions of both ES6 and Lodash
As the result of the article in jsperf.com (2015)shows that, Lodash performances faster than Native Javascript. I was shocked! Lodash is built on top of Native Javascript, how come a wrapped lib could do the same things faster than its mother language?
For the reason of curiosity, an experiment is made, by handling 10000 objects array, on both method, to see the different of between them by time, CPU and RAM.
Feel free to clone the git.
1- Generating a json file with 10,000 objects array
$ node gen
2- Two Fighting Players
3- Kick off fighting
Result
As the table above shows, map() in ES6 performance more or less as same as Lodash, in term of CPU, Memory or Handling time.
Update
— Thanks to correcting the experiment mistake, by Samuel Rouse and Zachary Leighton. Requiring Lodash module should have been considered (2018/05/14 10am).
Reference:
— https://github.com/wahengchang/lodash-vs-es6