💾 Archived View for heavysquare.com › notes › BEE1-memoize-or-rearrange-code.txt captured on 2022-06-04 at 00:15:11.

View Raw

More Information

-=-=-=-=-=-=-


~~ 2022-03-23T09:33:04+01:00

When you realize your code calls some expensive operation
with the same arguments over and over, you have at least two
options

1. rearrange your code so that you compute it once and then
pass it around

2. you memoize your operation


One thing that I realized today is that option (2) is not
very convenient if the parameter equality check is expensive itself.
Eg the parameter is a map of custom object keys and
list values, etc.