-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cacheSize option for defaultMemoize #210
cacheSize option for defaultMemoize #210
Conversation
Current coverage is 100% (diff: 100%)@@ master #210 diff @@
====================================
Files 1 1
Lines 12 18 +6
Methods 0 0
Messages 0 0
Branches 0 0
====================================
+ Hits 12 18 +6
Misses 0 0
Partials 0 0
|
3 similar comments
Thank @b6pzeusbc54tvhw5jgpyw8pwz2x6gs , this was an enlightenment. import memoizer from 'fast-memoize'
import { createSelectorCreator } from 'reselect'
// Why not Lodash's memoize?
// Because that won't work when the function takes more than one argument. And this is fast.
export const createSelector = createSelectorCreator(memoizer)
|
@ivawzh that's a great solution -- it would be super helpful if this were in the |
Superseded by #513 . |
As 3rd argument, now defaultMemoize() can get the
cacheSize
.There are two arrays to store previous argument arrays, previous results.
cacheSize
feature is designed as follows:In general, there is high a probability that last argument is used again.
So last arguemnts and result are added or updated to index: 0 in cacheArgsArr
and
cacheResultArr`Please feel free to contact us if you have something lacking.