reselect
reselect copied to clipboard
LRU implementation with hashmap and doubly linked list
Deploy Preview for reselect-docs canceled.
Name | Link |
---|---|
Latest commit | af114daf0fd9e6c0f5857382b598c30269c97e44 |
Latest deploy log | https://app.netlify.com/sites/reselect-docs/deploys/65d39e469dc6de0008edd250 |
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
this doesn't seem to use the equality function?
this doesn't seem to use the equality function?
@EskiMojo14 Yes, the equality function can not be used with a hashmap, we need to iterate throgh the all values which will not give us any advantage our the existing memoiser
@kuldeepsinghborana yeah, that's a problem, and that's what i was pointing to in the issue thread. We rely on equality checks, not a single key.
@markerikson @EskiMojo14 @aryaemami59 Can we create a new memoizer that takes a keyGen (key generator) function as an argument? The default keyGen function would convert the supplied argument into a JSON string. Subsequently, our cache Map would utilize this string as a key.
To enhance predictability in the JSON string, we can implement key sorting, ensuring that keys are consistently ordered for every object.
@kuldeepsinghborana no, just converting values into a string is potentially very expensive. Imagine doing a JSON.stringify()
on the entire Redux state for a large app.
array.join()
isn't going to help either. {a: 1}
and {a: 2}
are both going to stringify to "[object Object]"
, which is not unique.