[Performance] Lodash vs ES6 : map()

lodash vs es6 javascript map speed

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

2- Two Fighting Players

es6 map vs lodash map speed

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

https://jsperf.com/native-map-vs-lodash-map

https://www.valentinog.com/blog/memory-usage-node-js/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store