Memoization and precomputation have different purposes. You memoize a function if the arguments are not necessarily known in advance (or you don’t want to bother thinking about them), while precomputation helps you when a calculation can be broken down to stages, and one of these stages is reusable (and expensive). In some contexts, both are helpful.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Precompute some values of a function | 7 | 693 | June 1, 2022 | |
| Recommended way to cache results of expensive functions? | 6 | 4843 | February 14, 2021 | |
| Way to cache output from immutable input? | 2 | 794 | June 11, 2017 | |
| Memoizing a function using only a subset of arguments as an identifier | 3 | 348 | December 11, 2023 | |
| How to make a function store data to avoid repeating computation | 45 | 2034 | October 17, 2022 |