Performance-Analysis-JS

Map/Reduce/Filter/Find Vs For loop Vs For each Vs Lodash vs Ramda

Github星跟踪图

Performance-Analysis

Comparing native JavaScript array methods map, reduce, filter, and find against for loop, forEach loop and lodash methods. The analysis uses basic operations and heavy data manipulation to analyze the execution speed of each method.

To run

  1. Run npm install
  2. Generate the data for the tests by running npm run seed.
    • The default array is 10000 elements in length. You can create an array of a custom length by passing the desired size as an arugment, like so npm run seed 100000.
  3. For a small data set performance report run npm run t:s.
    • This runs the analysis on the first 5 elements of the array.
  4. For a performance report on the whole array run npm run t:l

To test your own function create them in the formulas.js file.

Results for small data set of array size 5 - 1000

small_data_set_result

Results for mid data set of array size 3000 - 20000

mid_data_set_result

Results for large data set of array size 50000 - 1000000

large_data_set_result

Coming Soon

  1. Ramda.js test
  2. Caching (inline, warm) considerations
  3. GC considerations

Note

  1. These results are computed using Node V8 v5.8.283.41
  2. These result does not consider the JIT, inline caching, hidden classes, deoptimizations, garbage collection, pretenuring etc.
  3. Result may vary as per env's.
  4. Red colour highlight in the above images is just for reference, will soon change.

Discussion/Posts

  1. https://news.ycombinator.com/item?id=17050798
  2. https://medium.com/@ideepak.jsd/javascript-performance-test-for-vs-for-each-vs-map-reduce-filter-find-32c1113f19d7

主要指标

概览
名称与所有者dg92/Performance-Analysis-JS
主编程语言JavaScript
编程语言JavaScript (语言数: 1)
平台
许可证
所有者活动
创建于2018-05-09 17:47:55
推送于2018-11-28 19:47:46
最后一次提交2018-05-29 20:56:49
发布数1
最新版本名称1.1 (发布于 )
第一版名称1.1 (发布于 )
用户参与
星数605
关注者数26
派生数45
提交数22
已启用问题?
问题数9
打开的问题数3
拉请求数4
打开的拉请求数0
关闭的拉请求数2
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?