Ven*_*ryx 2 javascript memoization
有许多用于记忆功能的 Javascript 库。
对于各种用例,有哪些最好的(高质量、灵活、快速等)?
我发现有大量不同的 JavaScript 记忆库,它们的运行方式都略有不同。
我将尝试在这里列出和比较“最好的”。(根据我估计它们的有效性/通用性大致排序;或者更确切地说,这是我有时间进一步查看它们的计划!)
核心功能:(用??yes、?no、??partial、?unknown 标记)
npm) 从 NPM 安装:该包在 npm 上可用。(为了便于集成/更新)
m-arg)多个参数:可以记住传递多个参数的函数。
o-arg) 对象参数:可以记住传递对象参数的函数。
o-hash) 对象散列:可以object
通过使用Map
/ 来记忆使用内部 JS 散列作为参数WeakMap
。(比序列化或缓存条目迭代更好的性能)
m-slot)多个插槽:可以存储缓存的结果,而不仅仅是最后一组参数。(无需手动创建新的“缓存槽”/“实例化”)
自动)自动记忆:可以根据常规传递的参数进行记忆;不需要特定于功能的设置/包装来进行基本的记忆。(可能仍需要通用包装)
核心功能) npm : ??, m-arg: ??, o-arg: ??, o-hash: ?, m-slot: ??, auto: ??
人气)GitHub 星数:~550;NPM 每周下载量:~76k (2020-04-24)
核心功能)npm : ??, m-arg: ??, o-arg: ??, o-hash: ??, m-slot: ??, auto: ??
流行度)GitHub 星数:~1.1k;NPM 每周下载量:~190 万 (2020-04-24)
核心功能)npm : ??, m-arg: ??, o-arg: ??, o-hash: ??, m-slot: ??, auto: ??
人气)GitHub 星数:~850;NPM 每周下载量:~60k (2020-04-24)
核心功能) npm : ??, m-arg: ??, o-arg: ??, o-hash: ?, m-slot: ??, auto: ??
人气)GitHub 星数:~2.2k;NPM 每周下载量:~381k (2020-04-24)
核心功能)npm : ??, m-arg: ??, o-arg: ??, o-hash: ??, m-slot: ??, auto: ??
核心功能) npm : ??, m-arg: ?, o-arg: ??, o-hash: ??, m-slot: ??, auto: ??
核心功能)npm : ??, m-arg: ??, o-arg: ??, o-hash: ??, m-slot: ??, auto: ??
核心功能)npm : ??, m-arg: ??, o-arg: ??, o-hash: ??, m-slot: ??, auto: ??
核心功能)npm : ??, m-arg: ?, o-arg: ??, o-hash: ?, m-slot: ??, auto: ??
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm : ??, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
[参见上面同步类别中的条目]
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
核心功能) npm: ?, m-arg: ?, o-arg: ?, o-hash: ?, m-slot: ?, auto: ?
实际上有比这更多的 JS 记忆库(我知道......),但我已经遗漏了那些库: