DEV Community

Discussion on: The agonizing necessity of cached calculations

Collapse
 
tulo69 profile image
stefano valicchia

Ok, understood. Memoization is good on simple inputs. Yes, an inner caching mechanism would be actually good. In that case the "cache invalidation key" need to be calculated inline when the operations occurs, an "hash of the subtree" could fit. If the function is iterative it will skip calculation on non changed branches.