memoizációval
Memoizációval, or memoization in English, is an optimization technique used primarily in computer programming to speed up functions by storing the results of expensive function calls and returning the cached result when the same inputs occur again. Think of it as a function's memory. When a function is called with certain arguments for the first time, its result is calculated and then stored in a lookup table, often a hash map or dictionary, keyed by the input arguments. The next time the function is called with the exact same arguments, instead of recomputing the result, the program simply retrieves the stored result from the cache.
This technique is particularly effective for functions that are computationally expensive to execute, have a high
While memoization can significantly improve performance, it comes with a trade-off: increased memory usage to store