-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Introduce {type: 'last', number: 1} memoize interface #2078
Comments
Interesting ideas @zhujinxuan! For 2, it might be interesting to design a way for For 3 that's a great point. We can ignore the "lots of undo" case too, not caching that method at all sounds good to me. I'd like to get rid of the All that said, I think there is potentially more important work to be done for performance in converting many of these
I think the gains from using paths on these might be really big. I'd rather merge fixes there before adding more complexity to our memoization techniques, or adding more complexity with performance hacks elsewhere. |
If we want to use Immutable.is to compare. We have to limit the potential candidates to compare for performance. I think perhaps caching the last one or last three is a solution. |
As of #3093 (which was just merged), I believe this issue is no longer applicable, because a lot has changed. I'm going through and closing out any potential issues that are not out of date with the overhaul. Thanks for understanding. |
Do you want to request a feature or report a bug?
feature
What's the current behavior?
For all memoized functions, we cache all evaluated result. That may result cache miss and memory leak.
What's the expected behavior?
For several functions, we shall only cache the last result.
getBlocksByType
getBlocksAtRange
. It is not easy to re-hit the same cache with the same immutable Object after several operations.normalize
. Whennormalize
node is non-null, it will be normalized and the node is stored in history stack. We do not need to cache this function unless user has a lot of undo. (Additionally, current undo->redo conflicts with normalization, when an undo triggers a normalization, then the redo stack is overwritten.)atOffset
,atPosition
. These functions are always called with the current selection. If selection are changed, it will be unlikely to be called again. Perhaps we can only cache the last one or last three result of this function.Just wondering if there is anyone else working on memoize interface. I can work on this in Oct if there is none else working on it.
The text was updated successfully, but these errors were encountered: