Memoization
Published Mar 26, 2022Updated Oct 26, 2022
Contribute to Docs
Memoization is a technique that improves the speed of a program by storing any new inputs for future reference, if needed. This cuts down on any repeated computations in the program where the same inputs are being used to return the same result.
This technique gets its name from the Latin word, “memorandum”, which means to be remembered. Memoization can be applied to many contexts in computer programming, including:
- Making calls to recursive or pure functions where some calculations use the same inputs and return the same outputs.
- Fetching from the server with the same base API endpoints.
Memoization can be implemented in most programming languages, including JavaScript and Python. However, while memoization saves performance time, it comes with a cost in memory space since it is caching results that were already calculated.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.