Amazing Lazy.js
# 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
Demo:https://github.com/Cuiyansong/my-react-experiment/blob/master/src/Javascript-Performance/lazy-js-and-lodash-performance.perf.js ↩︎
Benchmark:http://danieltao.com/lazy.js/ ↩︎
lazyjs自述:https://philosopherdeveloper.com/posts/introducing-lazy-js.html ↩︎
lazy-evaluation:https://www.yansong.fun/2020/03/07/lazy-evaluation/ ↩︎