本文介绍了哪些备忘录库可用于Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有许多用于记忆功能的Javascript库.

针对各种用例,最好的是哪些(高质量,灵活,快速等)?

解决方案

我发现这里有个不同的JavaScript备注库,它们的运行方式略有不同. /p>

我将在此处尝试列出和比较最佳"产品. (大致取决于我估计它们的有效性/通用性;或更确切地说,一旦我有时间进一步研究它们,那就是该计划!)

核心功能 :(标有✔️yes,❌no,⚙️partial,❔未知)

用于同步功能

moize (基于微记忆)

memoizee

mobx-utils:computedFn

快速记忆

地图备忘录

lodash.memoize (代码)

记忆减弱

存储不变的

underscore.memoize (代码)

记忆状态

kashe

nano-memoize

记忆化

memoize-fn

memoize-cache

记住一个

use-memo-one

@ emotion/weak-memoize

lru-memoizer

内存

memoizejs

记忆化

重新选择

纪念品

memoize-bind

memoizesync

@ thi.ng/memoize

trie-memoize

memobind

memoize-id

@ bigcommerce/memoize

用于异步功能

mobx-utils:computedFn

p-memoize

node-memoizeasync

承诺存储

use-async-me

async-memo-ize

memoize-async

讨论

实际上,JS记忆库比这个要多(我知道...),但是我省略了其中的库:

  • 无法记住内存. (例如,仅基于文件的缓存)
  • 无法记住独立功能. (例如,仅适用于类方法)
  • 不是开源的,也不是在某个疯狂的地方托管像这样 XD.
  • 超出了结果的前几页. (一个人只能为此花很多时间...)

There are many Javascript libraries out there for memoizing functions.

What are some of the best ones (high quality, flexible, fast, etc.), for the various use-cases?

解决方案

I've found that there are tons of different JavaScript memoization libraries out there, and they all operate in slightly different ways.

I'll attempt to list and compare the "best" ones here. (ordered roughly by how effective/general-purpose I estimate them to be; or rather, that's the plan once I have time to look them over further!)

Core features: (marked with ✔️yes, ❌no, ⚙️partial, ❔unknown)

For synchronous functions

moize (based on micro-memoize)

memoizee

mobx-utils:computedFn

fast-memoize

map-memo

lodash.memoize (code)

memoize-weak

memoize-immutable

underscore.memoize (code)

memoize-state

kashe

nano-memoize

memoizerific

memoize-fn

memoize-cache

memoize-one

use-memo-one

@emotion/weak-memoize

lru-memoizer

mem

memoizejs

memize

reselect

rememo

memoize-bind

memoizesync

@thi.ng/memoize

trie-memoize

memobind

memoize-id

@bigcommerce/memoize

For asynchronous functions

mobx-utils:computedFn

p-memoize

node-memoizeasync

promise-memoize

use-async-memo

async-memo-ize

memoize-async

Discussion

There are actually many more JS memoization libraries than this (I know...), but I've left out ones where the library:

  • Cannot memoize in-memory. (eg. file-based cache only)
  • Cannot memoize standalone functions. (eg. class methods only)
  • Is not open-source, or hosted at some crazy place like this XD.
  • Was beyond the first few pages of results. (one can only invest so much time into this...)

这篇关于哪些备忘录库可用于Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 01:09