Using memoization or cache layers