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.