Provide Caching For Your Complex Functions

Function caching, or more specifically memoization, is a code optimization technique that can be used to speed up code that calls complex functions with the same inputs.  Let’s take a look at the classic fibonacci function: 1: private int Fib(int val) 2: { 3: return val <= 2 ? 1 : Fib(val – 2) +…

2