Amazing Lazy.js

Stephen Cui ... 2020-03-07 23:07:20
  • LazyJS
Less than 1 minute

# Amazing Lazy.js

Note: This library is experimental and still a work in progress. v0.5.1

# What is lazy.js

Lazy.js is a functional utility library for JavaScript, similar to Underscore and Lodash, but with a lazy engine under the hood that strives to do as little work as possible while being as flexible as possible.

在处理大数据量的情况下,性能是优于原生实现以及类lodash类库[1], benchmark的对比官网也给了很详细的例子[2]

# Why so fast

从作者本人13年的文章中总结出如下结论[3]

  • lazy evaluation[4]
  • no extra array variable, 每次中间迭代使用的是XXXSequence作为下一次执行的入参

# Reference


  1. Demo:https://github.com/Cuiyansong/my-react-experiment/blob/master/src/Javascript-Performance/lazy-js-and-lodash-performance.perf.js ↩︎

  2. Benchmark:http://danieltao.com/lazy.js/ ↩︎

  3. lazyjs自述:https://philosopherdeveloper.com/posts/introducing-lazy-js.html ↩︎

  4. lazy-evaluation:https://www.yansong.fun/2020/03/07/lazy-evaluation/ ↩︎

Last update: October 7, 2021 04:50
Contributors: Stephen Cui